test/langtools/jdk/jshell/ToolCommandOptionTest.java
author dtitov
Tue, 08 Oct 2019 11:18:00 -0700
changeset 58506 dfe3d11378cc
parent 47216 71c04702a3d5
permissions -rw-r--r--
8199136: Dead code in src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java Reviewed-by: dholmes, dtitov Contributed-by: mandrikov@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
     1
/*
45749
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
     2
 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
     4
 *
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
     7
 * published by the Free Software Foundation.
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
     8
 *
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    13
 * accompanied this code).
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    14
 *
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    18
 *
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    21
 * questions.
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    22
 */
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    23
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    24
 /*
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    25
 * @test
45749
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
    26
 * @bug 8157395 8157393 8157517 8158738 8167128 8163840 8167637 8170368 8172102 8172179 8177847
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    27
 * @summary Tests of jshell comand options, and undoing operations
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    28
 * @modules jdk.jshell/jdk.internal.jshell.tool
42412
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
    29
 *          jdk.compiler/com.sun.tools.javac.api
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
    30
 *          jdk.compiler/com.sun.tools.javac.main
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
    31
 * @library /tools/lib
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    32
 * @build ToolCommandOptionTest ReplToolTesting
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    33
 * @run testng ToolCommandOptionTest
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    34
 */
42412
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
    35
import java.nio.file.Path;
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    36
import org.testng.annotations.Test;
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    37
import static org.testng.Assert.assertFalse;
45749
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
    38
import static org.testng.Assert.assertTrue;
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    39
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    40
@Test
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    41
public class ToolCommandOptionTest extends ReplToolTesting {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    42
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    43
    public void listTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    44
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    45
                (a) -> assertCommand(a, "int x;",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    46
                        "x ==> 0"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    47
                (a) -> assertCommand(a, "/li",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    48
                        "1 : int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    49
                (a) -> assertCommandOutputStartsWith(a, "/lis -st",
42972
47ca49eee534 8172102: jshell tool: remove print method forwarding to System.out from default startup
rfield
parents: 42412
diff changeset
    50
                        "s1 : import"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    51
                (a) -> assertCommandOutputStartsWith(a, "/list -all",
42972
47ca49eee534 8172102: jshell tool: remove print method forwarding to System.out from default startup
rfield
parents: 42412
diff changeset
    52
                        "s1 : import"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    53
                (a) -> assertCommandOutputContains(a, "/list -all",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    54
                        "1 : int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    55
                (a) -> assertCommandOutputContains(a, "/list -history",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    56
                        "int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    57
                (a) -> assertCommandOutputContains(a, "/li -h",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    58
                        "/lis -st"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    59
                (a) -> assertCommand(a, "/list -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    60
                        "|  Unknown option: -furball -- /list -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    61
                (a) -> assertCommand(a, "/list x",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    62
                        "1 : int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    63
                (a) -> assertCommand(a, "/li x -start",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    64
                        "|  Options and snippets must not both be used: /list x -start"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    65
                (a) -> assertCommand(a, "/l -st -al",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    66
                        "|  Conflicting options -- /list -st -al")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    67
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    68
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    69
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    70
    public void typesTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    71
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    72
                (a) -> assertCommand(a, "int x",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    73
                        "x ==> 0"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    74
                (a) -> assertCommand(a, "/types x",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    75
                        "|  This command does not accept the snippet 'x' : int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    76
                (a) -> assertCommand(a, "class C {}",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    77
                        "|  created class C"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    78
                (a) -> assertCommand(a, "/ty",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    79
                        "|    class C"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    80
                (a) -> assertCommand(a, "/ty -st",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    81
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    82
                (a) -> assertCommand(a, "/types -all",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    83
                        "|    class C"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    84
                (a) -> assertCommand(a, "/types -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    85
                        "|  Unknown option: -furball -- /types -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    86
                (a) -> assertCommand(a, "/types C",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    87
                        "|    class C"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    88
                (a) -> assertCommand(a, "/types C -start",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    89
                        "|  Options and snippets must not both be used: /types C -start"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    90
                (a) -> assertCommand(a, "/ty -st -al",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    91
                        "|  Conflicting options -- /types -st -al")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    92
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    93
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    94
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    95
    public void dropTest() {
40588
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38539
diff changeset
    96
        test(false, new String[]{"--no-startup"},
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    97
                (a) -> assertCommand(a, "int x = 5;",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    98
                        "x ==> 5"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    99
                (a) -> assertCommand(a, "x",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   100
                        "x ==> 5"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   101
                (a) -> assertCommand(a, "long y;",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   102
                        "y ==> 0"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   103
                (a) -> assertCommand(a, "/drop -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   104
                        "|  Unknown option: -furball -- /drop -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   105
                (a) -> assertCommand(a, "/drop -all",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   106
                        "|  Unknown option: -all -- /drop -all"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   107
                (a) -> assertCommandOutputStartsWith(a, "/drop z",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   108
                        "|  No such snippet: z"),
41514
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   109
                (a) -> assertCommand(a, "/drop 2",
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   110
                        ""),
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   111
                (a) -> assertCommandOutputStartsWith(a, "23qwl",
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   112
                        "|  Error:"),
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   113
                (a) -> assertCommandOutputStartsWith(a, "/drop e1",
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   114
                        "|  This command does not accept the snippet 'e1' : 23qwl"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   115
                (a) -> assertCommand(a, "/dr x y",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   116
                        "|  dropped variable x\n" +
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   117
                        "|  dropped variable y"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   118
                (a) -> assertCommand(a, "/list",
41514
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   119
                        "")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   120
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   121
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   122
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   123
    public void setEditorTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   124
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   125
                (a) -> assertCommand(a, "/set editor -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   126
                        "|  Unknown option: -furball -- /set editor -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   127
                (a) -> assertCommand(a, "/set editor -furball prog",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   128
                        "|  Unknown option: -furball -- /set editor -furball prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   129
                (a) -> assertCommand(a, "/set editor -furball -mattress",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   130
                        "|  Unknown option: -furball -mattress -- /set editor -furball -mattress"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   131
                (a) -> assertCommand(a, "/set editor -default prog",
41641
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   132
                        "|  Specify -default option, -delete option, or program -- /set editor -default prog"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   133
                (a) -> assertCommand(a, "/set editor prog",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   134
                        "|  Editor set to: prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   135
                (a) -> assertCommand(a, "/set editor prog -default",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   136
                        "|  Editor set to: prog -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   137
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   138
                        "|  /set editor prog -default"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   139
                (a) -> assertCommand(a, "/se ed prog -furball",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   140
                        "|  Editor set to: prog -furball"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   141
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   142
                        "|  /set editor prog -furball"),
41641
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   143
                (a) -> assertCommand(a, "/se ed -delete",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   144
                        "|  Editor set to: -default"),
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   145
                (a) -> assertCommand(a, "/set editor",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   146
                        "|  /set editor -default"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   147
                (a) -> assertCommand(a, "/set editor prog arg1 -furball arg3 -default arg4",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   148
                        "|  Editor set to: prog arg1 -furball arg3 -default arg4"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   149
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   150
                        "|  /set editor prog arg1 -furball arg3 -default arg4"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   151
                (a) -> assertCommand(a, "/set editor -default",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   152
                        "|  Editor set to: -default"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   153
                (a) -> assertCommand(a, "/se edi -def",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   154
                        "|  Editor set to: -default"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   155
                (a) -> assertCommand(a, "/set editor",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   156
                        "|  /set editor -default")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   157
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   158
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   159
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   160
    public void retainEditorTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   161
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   162
                (a) -> assertCommand(a, "/set editor -retain -furball",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   163
                        "|  Unknown option: -furball -- /set editor -retain -furball"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   164
                (a) -> assertCommand(a, "/set editor -retain -furball prog",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   165
                        "|  Unknown option: -furball -- /set editor -retain -furball prog"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   166
                (a) -> assertCommand(a, "/set editor -retain -furball -mattress",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   167
                        "|  Unknown option: -furball -mattress -- /set editor -retain -furball -mattress"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   168
                (a) -> assertCommand(a, "/set editor -retain -default prog",
41641
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   169
                        "|  Specify -default option, -delete option, or program -- /set editor -retain -default prog"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   170
                (a) -> assertCommand(a, "/set editor -retain -wait",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   171
                        "|  -wait applies to external editors"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   172
                (a) -> assertCommand(a, "/set editor -retain -default -wait",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   173
                        "|  -wait applies to external editors"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   174
                (a) -> assertCommand(a, "/set editor -retain prog",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   175
                        "|  Editor set to: prog\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   176
                        "|  Editor setting retained: prog"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   177
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   178
                        "|  /set editor -retain prog"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   179
                (a) -> assertCommand(a, "/se ed other",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   180
                        "|  Editor set to: other"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   181
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   182
                        "|  /set editor -retain prog\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   183
                        "|  /set editor other"),
41641
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   184
                (a) -> assertCommand(a, "/se ed -delete",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   185
                        "|  Editor set to: prog"),
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   186
                (a) -> assertCommand(a, "/set editor",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   187
                        "|  /set editor -retain prog"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   188
                (a) -> assertCommand(a, "/set editor -retain prog -default",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   189
                        "|  Editor set to: prog -default\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   190
                        "|  Editor setting retained: prog -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   191
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   192
                        "|  /set editor -retain prog -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   193
                (a) -> assertCommand(a, "/se ed -retain prog -furball",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   194
                        "|  Editor set to: prog -furball\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   195
                        "|  Editor setting retained: prog -furball"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   196
                (a) -> assertCommand(a, "/set editor -retain prog arg1 -furball arg3 -default arg4",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   197
                        "|  Editor set to: prog arg1 -furball arg3 -default arg4\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   198
                        "|  Editor setting retained: prog arg1 -furball arg3 -default arg4"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   199
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   200
                        "|  /set editor -retain prog arg1 -furball arg3 -default arg4"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   201
                (a) -> assertCommand(a, "/set editor -retain -default",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   202
                        "|  Editor set to: -default\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   203
                        "|  Editor setting retained: -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   204
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   205
                        "|  /set editor -retain -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   206
                (a) -> assertCommand(a, "/se e -ret -def",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   207
                        "|  Editor set to: -default\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   208
                        "|  Editor setting retained: -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   209
                (a) -> assertCommand(a, "/set editor -retain",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   210
                        "|  Editor setting retained: -default")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   211
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   212
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   213
41641
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   214
    public void setEditorEnvTest() {
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   215
        setEnvVar("EDITOR", "best one");
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   216
        setEditorEnvSubtest();
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   217
        setEnvVar("EDITOR", "not this");
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   218
        setEnvVar("VISUAL", "best one");
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   219
        setEditorEnvSubtest();
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   220
        setEnvVar("VISUAL", "not this");
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   221
        setEnvVar("JSHELLEDITOR", "best one");
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   222
        setEditorEnvSubtest();
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   223
    }
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   224
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   225
    private void setEditorEnvSubtest() {
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   226
        test(
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   227
                (a) -> assertCommand(a, "/set editor",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   228
                        "|  /set editor best one"),
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   229
                (a) -> assertCommand(a, "/set editor prog",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   230
                        "|  Editor set to: prog"),
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   231
                (a) -> assertCommand(a, "/set editor",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   232
                        "|  /set editor prog"),
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   233
                (a) -> assertCommand(a, "/set editor -delete",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   234
                        "|  Editor set to: best one"),
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   235
                (a) -> assertCommand(a, "/set editor -retain stored editor",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   236
                        "|  Editor set to: stored editor\n" +
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   237
                        "|  Editor setting retained: stored editor")
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   238
        );
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   239
        test(
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   240
                (a) -> assertCommand(a, "/set editor",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   241
                        "|  /set editor -retain stored editor"),
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   242
                (a) -> assertCommand(a, "/set editor -delete -retain",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   243
                        "|  Editor set to: best one")
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   244
        );
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   245
    }
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   246
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   247
    public void setStartTest() {
42412
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   248
        Compiler compiler = new Compiler();
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   249
        Path startup = compiler.getPath("StartTest/startup.txt");
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   250
        compiler.writeToFile(startup, "int iAmHere = 1234;");
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   251
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   252
                (a) -> assertCommand(a, "/set start -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   253
                        "|  Unknown option: -furball -- /set start -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   254
                (a) -> assertCommand(a, "/set start -furball pyle",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   255
                        "|  Unknown option: -furball -- /set start -furball pyle"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   256
                (a) -> assertCommand(a, "/se st pyle -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   257
                        "|  Unknown option: -furball -- /set st pyle -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   258
                (a) -> assertCommand(a, "/set start -furball -mattress",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   259
                        "|  Unknown option: -furball -mattress -- /set start -furball -mattress"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   260
                (a) -> assertCommand(a, "/set start foo -default",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   261
                        "|  Specify no more than one of -default, -none, or a startup file name -- /set start foo -default"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   262
                (a) -> assertCommand(a, "/set start frfg",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   263
                        "|  File 'frfg' for '/set start' is not found."),
42972
47ca49eee534 8172102: jshell tool: remove print method forwarding to System.out from default startup
rfield
parents: 42412
diff changeset
   264
                (a) -> assertCommand(a, "/set start DEFAULT frfg",
47ca49eee534 8172102: jshell tool: remove print method forwarding to System.out from default startup
rfield
parents: 42412
diff changeset
   265
                        "|  File 'frfg' for '/set start' is not found."),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   266
                (a) -> assertCommand(a, "/set start -default",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   267
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   268
                (a) -> assertCommand(a, "/set start",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   269
                        "|  /set start -default"),
42972
47ca49eee534 8172102: jshell tool: remove print method forwarding to System.out from default startup
rfield
parents: 42412
diff changeset
   270
                (a) -> assertCommand(a, "/set start DEFAULT",
47ca49eee534 8172102: jshell tool: remove print method forwarding to System.out from default startup
rfield
parents: 42412
diff changeset
   271
                        ""),
47ca49eee534 8172102: jshell tool: remove print method forwarding to System.out from default startup
rfield
parents: 42412
diff changeset
   272
                (a) -> assertCommand(a, "/set start",
47ca49eee534 8172102: jshell tool: remove print method forwarding to System.out from default startup
rfield
parents: 42412
diff changeset
   273
                        "|  /set start -default"),
47ca49eee534 8172102: jshell tool: remove print method forwarding to System.out from default startup
rfield
parents: 42412
diff changeset
   274
                (a) -> assertCommand(a, "/set start DEFAULT PRINTING",
47ca49eee534 8172102: jshell tool: remove print method forwarding to System.out from default startup
rfield
parents: 42412
diff changeset
   275
                        ""),
47ca49eee534 8172102: jshell tool: remove print method forwarding to System.out from default startup
rfield
parents: 42412
diff changeset
   276
                (a) -> assertCommandOutputContains(a, "/set start",
43263
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   277
                        "/set start DEFAULT PRINTING", "void println", "import java.util.*"),
42412
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   278
                (a) -> assertCommand(a, "/set start " + startup.toString(),
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   279
                        ""),
43263
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   280
                (a) -> assertCommandOutputContains(a, "/set start",
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   281
                        "|  /set start " + startup + "\n" +
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   282
                        "|  ---- " + startup + " @ ", " ----\n" +
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   283
                        "|  int iAmHere = 1234;\n"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   284
                (a) -> assertCommand(a, "/se sta -no",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   285
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   286
                (a) -> assertCommand(a, "/set start",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   287
                        "|  /set start -none")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   288
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   289
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   290
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   291
    public void retainStartTest() {
42412
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   292
        Compiler compiler = new Compiler();
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   293
        Path startup = compiler.getPath("StartTest/startup.txt");
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   294
        compiler.writeToFile(startup, "int iAmHere = 1234;");
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   295
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   296
                (a) -> assertCommand(a, "/set start -retain -furball",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   297
                        "|  Unknown option: -furball -- /set start -retain -furball"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   298
                (a) -> assertCommand(a, "/set start -retain -furball pyle",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   299
                        "|  Unknown option: -furball -- /set start -retain -furball pyle"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   300
                (a) -> assertCommand(a, "/se st -re pyle -furball",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   301
                        "|  Unknown option: -furball -- /set st -re pyle -furball"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   302
                (a) -> assertCommand(a, "/set start -retain -furball -mattress",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   303
                        "|  Unknown option: -furball -mattress -- /set start -retain -furball -mattress"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   304
                (a) -> assertCommand(a, "/set start -retain foo -default",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   305
                        "|  Specify no more than one of -default, -none, or a startup file name -- /set start -retain foo -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   306
                (a) -> assertCommand(a, "/set start -retain -default foo",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   307
                        "|  Specify no more than one of -default, -none, or a startup file name -- /set start -retain -default foo"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   308
                (a) -> assertCommand(a, "/set start -retain frfg",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   309
                        "|  File 'frfg' for '/set start' is not found."),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   310
                (a) -> assertCommand(a, "/set start -retain -default",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   311
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   312
                (a) -> assertCommand(a, "/set start",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   313
                        "|  /set start -retain -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   314
                (a) -> assertCommand(a, "/set sta -no",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   315
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   316
                (a) -> assertCommand(a, "/set start",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   317
                        "|  /set start -retain -default\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   318
                        "|  /set start -none"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   319
                (a) -> assertCommand(a, "/se st -ret",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   320
                        ""),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   321
                (a) -> assertCommand(a, "/se sta",
42412
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   322
                        "|  /set start -retain -none"),
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   323
                (a) -> assertCommand(a, "/set start -retain " + startup.toString(),
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   324
                        ""),
43263
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   325
                (a) -> assertCommand(a, "/set start DEFAULT PRINTING",
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   326
                        ""),
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   327
                (a) -> assertCommandOutputStartsWith(a, "/set start",
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   328
                        "|  /set start -retain " + startup.toString() + "\n" +
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   329
                        "|  /set start DEFAULT PRINTING\n" +
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   330
                        "|  ---- " + startup.toString() + " @ "),
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   331
                (a) -> assertCommandOutputContains(a, "/set start",
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   332
                        "|  ---- DEFAULT ----\n",
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   333
                        "|  ---- PRINTING ----\n",
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   334
                        "|  int iAmHere = 1234;\n",
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   335
                        "|  void println(String s)",
ca999fb7b46d 8172179: jshell tool: builtin startup settings should be by reference not content
rfield
parents: 42972
diff changeset
   336
                        "|  import java.io.*;")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   337
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   338
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   339
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   340
    public void setModeTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   341
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   342
                (a) -> assertCommandOutputContains(a, "/set mode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   343
                        "|  /set format verbose unresolved"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   344
                (a) -> assertCommandOutputStartsWith(a, "/set mode *",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   345
                        "|  Expected a feedback mode name: *"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   346
                (a) -> assertCommandOutputStartsWith(a, "/set mode -quiet",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   347
                        "|  Missing the feedback mode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   348
                (a) -> assertCommandOutputStartsWith(a, "/set mode -quiet *",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   349
                        "|  Expected a feedback mode name: *"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   350
                (a) -> assertCommandOutputStartsWith(a, "/set mode amode normal thing",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   351
                        "|  Unexpected arguments at end of command: thing"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   352
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   353
                        "|  To create a new mode either the -command or the -quiet option must be used"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   354
                (a) -> assertCommand(a, "/set mode mymode -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   355
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   356
                (a) -> assertCommand(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   357
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   358
                (a) -> assertCommand(a, "/set mode mymode normal -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   359
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   360
                (a) -> assertCommand(a, "/set mode -del mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   361
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   362
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -command -quiet",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   363
                        "|  Conflicting options"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   364
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete -quiet",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   365
                        "|  Conflicting options"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   366
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -command -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   367
                        "|  Conflicting options"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   368
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -d",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   369
                        "|  No feedback mode named: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   370
                (a) -> assertCommandOutputStartsWith(a, "/set mode normal -c",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   371
                        "|  Mode to be created already exists: normal"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   372
                (a) -> assertCommand(a, "/se mo -c mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   373
                        "|  Created new feedback mode: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   374
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   375
                        "|  /set mode mymode -command"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   376
                (a) -> assertCommand(a, "/set feedback mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   377
                        "|  Feedback mode: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   378
                (a) -> assertCommand(a, "/se fe",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   379
                        "|  /set feedback mymode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   380
                        "|  \n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   381
                        "|  Available feedback modes:\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   382
                        "|     concise\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   383
                        "|     mymode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   384
                        "|     normal\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   385
                        "|     silent\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   386
                        "|     verbose"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   387
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   388
                        "|  The current feedback mode 'mymode' cannot be deleted"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   389
                (a) -> assertCommand(a, "/set feedback no",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   390
                        "|  Feedback mode: normal"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   391
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   392
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   393
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   394
                        "|  To create a new mode either the -command or the -quiet option must be used -- \n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   395
                        "|  Does not match any current feedback mode: mymode -- /set mode mymode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   396
                        "|  Available feedback modes:"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   397
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   398
                        (s) -> assertFalse(s.contains("mymode"), "Didn't delete: " + s))
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   399
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   400
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   401
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   402
    public void setModeSmashTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   403
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   404
                (a) -> assertCommand(a, "/set mode mymode -command",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   405
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   406
                (a) -> assertCommand(a, "/set feedback mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   407
                        "|  Feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   408
                (a) -> assertCommand(a, "/set format mymode display 'blurb'",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   409
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   410
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   411
                        "blurb"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   412
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode normal",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   413
                        "|  To create a new mode either the -command or the -quiet option must be used"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   414
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -command normal",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   415
                        "|  Mode to be created already exists: mymode"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   416
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   417
                        "|  The current feedback mode 'mymode' cannot be deleted, use '/set feedback' first"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   418
                (a) -> assertCommand(a, "/set feedback normal",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   419
                        "|  Feedback mode: normal"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   420
                (a) -> assertCommand(a, "/set mode mymode -delete",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   421
                        ""),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   422
                (a) -> assertCommand(a, "/set mode mymode -command normal",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   423
                        "|  Created new feedback mode: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   424
                (a) -> assertCommand(a, "/set feedback mymode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   425
                        "|  Feedback mode: mymode"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   426
                (a) -> assertCommandOutputContains(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   427
                        " ==> 45")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   428
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   429
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   430
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   431
    public void retainModeTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   432
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   433
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   434
                        "|  Missing the feedback mode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   435
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain *",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   436
                        "|  Expected a feedback mode name: *"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   437
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain amode normal",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   438
                        "|  Unexpected arguments at end of command: normal"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   439
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain mymode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   440
                        "|  No feedback mode named: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   441
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain mymode -delete",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   442
                        "|  No feedback mode named: mymode"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   443
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain -d mymode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   444
                        "|  No feedback mode named: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   445
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain normal",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   446
                        "|  Not valid with a predefined mode: normal"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   447
                (a) -> assertCommand(a, "/set mode mymode verbose -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   448
                        "|  Created new feedback mode: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   449
                (a) -> assertCommand(a, "/set mode -retain mymode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   450
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   451
                (a) -> assertCommand(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   452
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   453
                (a) -> assertCommand(a, "/set mode -retain mymode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   454
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   455
                (a) -> assertCommand(a, "/set mode kmode normal -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   456
                        "|  Created new feedback mode: kmode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   457
                (a) -> assertCommand(a, "/set mode -retain kmode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   458
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   459
                (a) -> assertCommand(a, "/set mode kmode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   460
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   461
                (a) -> assertCommand(a, "/set mode tmode normal -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   462
                        "|  Created new feedback mode: tmode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   463
                (a) -> assertCommandOutputStartsWith(a, "/set feedback -retain tmode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   464
                        "|  '/set feedback -retain <mode>' requires that <mode> is predefined or has been retained with '/set mode -retain'"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   465
                (a) -> assertCommand(a, "/set format tmode display 'YES'",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   466
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   467
                (a) -> assertCommand(a, "/set feedback tmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   468
                        "|  Feedback mode: tmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   469
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   470
                        "YES"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   471
                (a) -> assertCommand(a, "/set mode -retain tmode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   472
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   473
                (a) -> assertCommand(a, "/set feedback -retain tmode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   474
                        "|  Feedback mode: tmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   475
                (a) -> assertCommand(a, "/set format tmode display 'blurb'",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   476
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   477
                (a) -> assertCommand(a, "/set format tmode display",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   478
                        "|  /set format tmode display \"blurb\""),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   479
                (a) -> assertCommandOutputContains(a, "/set mode tmode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   480
                        "|  /set format tmode display \"YES\""),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   481
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   482
                        "blurb")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   483
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   484
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   485
                (a) -> assertCommand(a, "/set format tmode display",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   486
                        "|  /set format tmode display \"YES\""),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   487
                (a) -> assertCommandOutputContains(a, "/set mode tmode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   488
                        "|  /set format tmode display \"YES\""),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   489
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   490
                        "YES"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   491
                (a) -> assertCommand(a, "/set feedback kmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   492
                        "|  Feedback mode: kmode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   493
                (a) -> assertCommand(a, "/set feedback",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   494
                        "|  /set feedback -retain tmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   495
                        "|  /set feedback kmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   496
                        "|  \n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   497
                        "|  Retained feedback modes:\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   498
                        "|     kmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   499
                        "|     tmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   500
                        "|  Available feedback modes:\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   501
                        "|     concise\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   502
                        "|     kmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   503
                        "|     normal\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   504
                        "|     silent\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   505
                        "|     tmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   506
                        "|     verbose"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   507
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain kmode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   508
                        "|  The current feedback mode 'kmode' cannot be deleted"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   509
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain tmode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   510
                        "|  The retained feedback mode 'tmode' cannot be deleted"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   511
                (a) -> assertCommand(a, "/set feedback -retain normal",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   512
                        "|  Feedback mode: normal"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   513
                (a) -> assertCommand(a, "/set mode -retain tmode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   514
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   515
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain kmode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   516
                        "")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   517
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   518
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   519
                (a) -> assertCommandOutputStartsWith(a, "/set feedback tmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   520
                        "|  Does not match any current feedback mode: tmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   521
                (a) -> assertCommandOutputStartsWith(a, "/set feedback kmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   522
                        "|  Does not match any current feedback mode: kmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   523
                (a) -> assertCommandOutputStartsWith(a, "/set feedback mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   524
                        "|  Does not match any current feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   525
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   526
                        (s) -> assertFalse(s.contains("mymode"), "Didn't delete mymode: " + s)),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   527
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   528
                        (s) -> assertFalse(s.contains("kmode"), "Didn't delete kmode: " + s)),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   529
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   530
                        (s) -> assertFalse(s.contains("tmode"), "Didn't delete tmode: " + s))
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   531
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   532
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   533
45749
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
   534
    public void retainModeDeleteLocalTest() {
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
   535
        test(
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
   536
                (a) -> assertCommand(a, "/set mode rmdlt normal -command",
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
   537
                        "|  Created new feedback mode: rmdlt"),
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
   538
                (a) -> assertCommand(a, "/set mode rmdlt -delete -retain ",
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
   539
                        ""),
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
   540
                (a) -> assertCommandCheckOutput(a, "/set feedback",
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
   541
                        (s) -> {
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
   542
                            assertTrue(s.contains("normal"), "Expected normal mode: " + s);
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
   543
                            assertFalse(s.contains("rmdlt"), "Didn't delete rmdlt: " + s);
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
   544
                        })
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
   545
        );
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
   546
    }
11797433fbc0 8177847: jshell tool: retain delete of non-retained mode does not locally delete
rfield
parents: 43263
diff changeset
   547
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   548
}