langtools/test/jdk/jshell/ToolCommandOptionTest.java
author rfield
Fri, 02 Dec 2016 10:17:03 -0800
changeset 42412 ca6f4f1914b2
parent 41641 a628785b9dd9
child 42972 47ca49eee534
permissions -rw-r--r--
8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform 8170015: jshell tool: /help output looks terrible on a 100 column wide terminal 8170368: jshell tool: post setting not properly applied, line-ends not prefixed correctly Reviewed-by: jlahoda
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
     1
/*
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
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
42412
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
    26
 * @bug 8157395 8157393 8157517 8158738 8167128 8163840 8167637 8170368
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;
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    38
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    39
@Test
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    40
public class ToolCommandOptionTest extends ReplToolTesting {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    41
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    42
    public void listTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    43
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    44
                (a) -> assertCommand(a, "int x;",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    45
                        "x ==> 0"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    46
                (a) -> assertCommand(a, "/li",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    47
                        "1 : int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    48
                (a) -> assertCommandOutputStartsWith(a, "/lis -st",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    49
                        "\n  s1 : import"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    50
                (a) -> assertCommandOutputStartsWith(a, "/list -all",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    51
                        "\n  s1 : import"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    52
                (a) -> assertCommandOutputContains(a, "/list -all",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    53
                        "1 : int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    54
                (a) -> assertCommandOutputContains(a, "/list -history",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    55
                        "int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    56
                (a) -> assertCommandOutputContains(a, "/li -h",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    57
                        "/lis -st"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    58
                (a) -> assertCommand(a, "/list -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    59
                        "|  Unknown option: -furball -- /list -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    60
                (a) -> assertCommand(a, "/list x",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    61
                        "1 : int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    62
                (a) -> assertCommand(a, "/li x -start",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    63
                        "|  Options and snippets must not both be used: /list x -start"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    64
                (a) -> assertCommand(a, "/l -st -al",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    65
                        "|  Conflicting options -- /list -st -al")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    66
        );
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
    public void typesTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    70
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    71
                (a) -> assertCommand(a, "int x",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    72
                        "x ==> 0"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    73
                (a) -> assertCommand(a, "/types x",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    74
                        "|  This command does not accept the snippet 'x' : int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    75
                (a) -> assertCommand(a, "class C {}",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    76
                        "|  created class C"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    77
                (a) -> assertCommand(a, "/ty",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    78
                        "|    class C"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    79
                (a) -> assertCommand(a, "/ty -st",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    80
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    81
                (a) -> assertCommand(a, "/types -all",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    82
                        "|    class C"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    83
                (a) -> assertCommand(a, "/types -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    84
                        "|  Unknown option: -furball -- /types -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    85
                (a) -> assertCommand(a, "/types C",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    86
                        "|    class C"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    87
                (a) -> assertCommand(a, "/types C -start",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    88
                        "|  Options and snippets must not both be used: /types C -start"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    89
                (a) -> assertCommand(a, "/ty -st -al",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    90
                        "|  Conflicting options -- /types -st -al")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    91
        );
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
    public void dropTest() {
40588
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38539
diff changeset
    95
        test(false, new String[]{"--no-startup"},
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    96
                (a) -> assertCommand(a, "int x = 5;",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    97
                        "x ==> 5"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    98
                (a) -> assertCommand(a, "x",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    99
                        "x ==> 5"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   100
                (a) -> assertCommand(a, "long y;",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   101
                        "y ==> 0"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   102
                (a) -> assertCommand(a, "/drop -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   103
                        "|  Unknown option: -furball -- /drop -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   104
                (a) -> assertCommand(a, "/drop -all",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   105
                        "|  Unknown option: -all -- /drop -all"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   106
                (a) -> assertCommandOutputStartsWith(a, "/drop z",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   107
                        "|  No such snippet: z"),
41514
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   108
                (a) -> assertCommand(a, "/drop 2",
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   109
                        ""),
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   110
                (a) -> assertCommandOutputStartsWith(a, "23qwl",
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   111
                        "|  Error:"),
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   112
                (a) -> assertCommandOutputStartsWith(a, "/drop e1",
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   113
                        "|  This command does not accept the snippet 'e1' : 23qwl"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   114
                (a) -> assertCommand(a, "/dr x y",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   115
                        "|  dropped variable x\n" +
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   116
                        "|  dropped variable y"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   117
                (a) -> assertCommand(a, "/list",
41514
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   118
                        "")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   119
        );
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
    public void setEditorTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   123
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   124
                (a) -> assertCommand(a, "/set editor -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   125
                        "|  Unknown option: -furball -- /set editor -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   126
                (a) -> assertCommand(a, "/set editor -furball prog",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   127
                        "|  Unknown option: -furball -- /set editor -furball prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   128
                (a) -> assertCommand(a, "/set editor -furball -mattress",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   129
                        "|  Unknown option: -furball -mattress -- /set editor -furball -mattress"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   130
                (a) -> assertCommand(a, "/set editor -default prog",
41641
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   131
                        "|  Specify -default option, -delete option, or program -- /set editor -default prog"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   132
                (a) -> assertCommand(a, "/set editor prog",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   133
                        "|  Editor set to: prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   134
                (a) -> assertCommand(a, "/set editor prog -default",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   135
                        "|  Editor set to: prog -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   136
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   137
                        "|  /set editor prog -default"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   138
                (a) -> assertCommand(a, "/se ed prog -furball",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   139
                        "|  Editor set to: prog -furball"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   140
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   141
                        "|  /set editor prog -furball"),
41641
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   142
                (a) -> assertCommand(a, "/se ed -delete",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   143
                        "|  Editor set to: -default"),
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   144
                (a) -> assertCommand(a, "/set editor",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   145
                        "|  /set editor -default"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   146
                (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
   147
                        "|  Editor set to: prog arg1 -furball arg3 -default arg4"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   148
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   149
                        "|  /set editor prog arg1 -furball arg3 -default arg4"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   150
                (a) -> assertCommand(a, "/set editor -default",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   151
                        "|  Editor set to: -default"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   152
                (a) -> assertCommand(a, "/se edi -def",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   153
                        "|  Editor set to: -default"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   154
                (a) -> assertCommand(a, "/set editor",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   155
                        "|  /set editor -default")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   156
        );
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
    public void retainEditorTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   160
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   161
                (a) -> assertCommand(a, "/set editor -retain -furball",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   162
                        "|  Unknown option: -furball -- /set editor -retain -furball"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   163
                (a) -> assertCommand(a, "/set editor -retain -furball prog",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   164
                        "|  Unknown option: -furball -- /set editor -retain -furball prog"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   165
                (a) -> assertCommand(a, "/set editor -retain -furball -mattress",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   166
                        "|  Unknown option: -furball -mattress -- /set editor -retain -furball -mattress"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   167
                (a) -> assertCommand(a, "/set editor -retain -default prog",
41641
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   168
                        "|  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
   169
                (a) -> assertCommand(a, "/set editor -retain -wait",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   170
                        "|  -wait applies to external editors"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   171
                (a) -> assertCommand(a, "/set editor -retain -default -wait",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   172
                        "|  -wait applies to external editors"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   173
                (a) -> assertCommand(a, "/set editor -retain prog",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   174
                        "|  Editor set to: prog\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   175
                        "|  Editor setting retained: prog"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   176
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   177
                        "|  /set editor -retain prog"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   178
                (a) -> assertCommand(a, "/se ed other",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   179
                        "|  Editor set to: other"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   180
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   181
                        "|  /set editor -retain prog\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   182
                        "|  /set editor other"),
41641
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   183
                (a) -> assertCommand(a, "/se ed -delete",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   184
                        "|  Editor set to: prog"),
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   185
                (a) -> assertCommand(a, "/set editor",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   186
                        "|  /set editor -retain prog"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   187
                (a) -> assertCommand(a, "/set editor -retain prog -default",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   188
                        "|  Editor set to: prog -default\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   189
                        "|  Editor setting retained: prog -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   190
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   191
                        "|  /set editor -retain prog -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   192
                (a) -> assertCommand(a, "/se ed -retain prog -furball",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   193
                        "|  Editor set to: prog -furball\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   194
                        "|  Editor setting retained: prog -furball"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   195
                (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
   196
                        "|  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
   197
                        "|  Editor setting retained: prog arg1 -furball arg3 -default arg4"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   198
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   199
                        "|  /set editor -retain prog arg1 -furball arg3 -default arg4"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   200
                (a) -> assertCommand(a, "/set editor -retain -default",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   201
                        "|  Editor set to: -default\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   202
                        "|  Editor setting retained: -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   203
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   204
                        "|  /set editor -retain -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   205
                (a) -> assertCommand(a, "/se e -ret -def",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   206
                        "|  Editor set to: -default\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   207
                        "|  Editor setting retained: -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   208
                (a) -> assertCommand(a, "/set editor -retain",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   209
                        "|  Editor setting retained: -default")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   210
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   211
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   212
41641
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   213
    public void setEditorEnvTest() {
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   214
        setEnvVar("EDITOR", "best one");
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   215
        setEditorEnvSubtest();
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   216
        setEnvVar("EDITOR", "not this");
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   217
        setEnvVar("VISUAL", "best one");
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   218
        setEditorEnvSubtest();
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   219
        setEnvVar("VISUAL", "not this");
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   220
        setEnvVar("JSHELLEDITOR", "best one");
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   221
        setEditorEnvSubtest();
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   222
    }
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
    private void setEditorEnvSubtest() {
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   225
        test(
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   226
                (a) -> assertCommand(a, "/set editor",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   227
                        "|  /set editor best one"),
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   228
                (a) -> assertCommand(a, "/set editor prog",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   229
                        "|  Editor set to: prog"),
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   230
                (a) -> assertCommand(a, "/set editor",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   231
                        "|  /set editor prog"),
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   232
                (a) -> assertCommand(a, "/set editor -delete",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   233
                        "|  Editor set to: best one"),
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   234
                (a) -> assertCommand(a, "/set editor -retain stored editor",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   235
                        "|  Editor set to: stored editor\n" +
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   236
                        "|  Editor setting retained: stored editor")
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   237
        );
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   238
        test(
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   239
                (a) -> assertCommand(a, "/set editor",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   240
                        "|  /set editor -retain stored editor"),
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   241
                (a) -> assertCommand(a, "/set editor -delete -retain",
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   242
                        "|  Editor set to: best one")
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 41635
diff changeset
   243
        );
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
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   246
    public void setStartTest() {
42412
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   247
        Compiler compiler = new Compiler();
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   248
        Path startup = compiler.getPath("StartTest/startup.txt");
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   249
        compiler.writeToFile(startup, "int iAmHere = 1234;");
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   250
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   251
                (a) -> assertCommand(a, "/set start -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   252
                        "|  Unknown option: -furball -- /set start -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   253
                (a) -> assertCommand(a, "/set start -furball pyle",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   254
                        "|  Unknown option: -furball -- /set start -furball pyle"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   255
                (a) -> assertCommand(a, "/se st pyle -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   256
                        "|  Unknown option: -furball -- /set st pyle -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   257
                (a) -> assertCommand(a, "/set start -furball -mattress",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   258
                        "|  Unknown option: -furball -mattress -- /set start -furball -mattress"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   259
                (a) -> assertCommand(a, "/set start foo -default",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   260
                        "|  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
   261
                (a) -> assertCommand(a, "/set start frfg",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   262
                        "|  File 'frfg' for '/set start' is not found."),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   263
                (a) -> assertCommand(a, "/set start -default",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   264
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   265
                (a) -> assertCommand(a, "/set start",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   266
                        "|  /set start -default"),
42412
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   267
                (a) -> assertCommand(a, "/set start " + startup.toString(),
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   268
                        ""),
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   269
                (a) -> assertCommand(a, "/set start",
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   270
                        "|  startup.jsh:\n" +
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   271
                        "|  int iAmHere = 1234;\n" +
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   272
                        "|  \n" +
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   273
                        "|  /set start startup.jsh"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   274
                (a) -> assertCommand(a, "/se sta -no",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   275
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   276
                (a) -> assertCommand(a, "/set start",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   277
                        "|  /set start -none")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   278
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   279
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   280
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   281
    public void retainStartTest() {
42412
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   282
        Compiler compiler = new Compiler();
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   283
        Path startup = compiler.getPath("StartTest/startup.txt");
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   284
        compiler.writeToFile(startup, "int iAmHere = 1234;");
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   285
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   286
                (a) -> assertCommand(a, "/set start -retain -furball",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   287
                        "|  Unknown option: -furball -- /set start -retain -furball"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   288
                (a) -> assertCommand(a, "/set start -retain -furball pyle",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   289
                        "|  Unknown option: -furball -- /set start -retain -furball pyle"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   290
                (a) -> assertCommand(a, "/se st -re pyle -furball",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   291
                        "|  Unknown option: -furball -- /set st -re pyle -furball"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   292
                (a) -> assertCommand(a, "/set start -retain -furball -mattress",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   293
                        "|  Unknown option: -furball -mattress -- /set start -retain -furball -mattress"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   294
                (a) -> assertCommand(a, "/set start -retain foo -default",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   295
                        "|  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
   296
                (a) -> assertCommand(a, "/set start -retain -default foo",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   297
                        "|  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
   298
                (a) -> assertCommand(a, "/set start -retain frfg",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   299
                        "|  File 'frfg' for '/set start' is not found."),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   300
                (a) -> assertCommand(a, "/set start -retain -default",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   301
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   302
                (a) -> assertCommand(a, "/set start",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   303
                        "|  /set start -retain -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   304
                (a) -> assertCommand(a, "/set sta -no",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   305
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   306
                (a) -> assertCommand(a, "/set start",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   307
                        "|  /set start -retain -default\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   308
                        "|  /set start -none"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   309
                (a) -> assertCommand(a, "/se st -ret",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   310
                        ""),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   311
                (a) -> assertCommand(a, "/se sta",
42412
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   312
                        "|  /set start -retain -none"),
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   313
                (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
   314
                        ""),
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   315
                (a) -> assertCommand(a, "/set start",
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   316
                        "|  startup.jsh:\n" +
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   317
                        "|  int iAmHere = 1234;\n" +
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   318
                        "|  \n" +
ca6f4f1914b2 8169828: jdk/jshell/ExternalEditorTest.java testStatementMush() fails frequently on all platform
rfield
parents: 41641
diff changeset
   319
                        "|  /set start -retain startup.jsh")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   320
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   321
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   322
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   323
    public void setModeTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   324
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   325
                (a) -> assertCommandOutputContains(a, "/set mode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   326
                        "|  /set format verbose unresolved"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   327
                (a) -> assertCommandOutputStartsWith(a, "/set mode *",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   328
                        "|  Expected a feedback mode name: *"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   329
                (a) -> assertCommandOutputStartsWith(a, "/set mode -quiet",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   330
                        "|  Missing the feedback mode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   331
                (a) -> assertCommandOutputStartsWith(a, "/set mode -quiet *",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   332
                        "|  Expected a feedback mode name: *"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   333
                (a) -> assertCommandOutputStartsWith(a, "/set mode amode normal thing",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   334
                        "|  Unexpected arguments at end of command: thing"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   335
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   336
                        "|  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
   337
                (a) -> assertCommand(a, "/set mode mymode -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   338
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   339
                (a) -> assertCommand(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   340
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   341
                (a) -> assertCommand(a, "/set mode mymode normal -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   342
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   343
                (a) -> assertCommand(a, "/set mode -del mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   344
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   345
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -command -quiet",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   346
                        "|  Conflicting options"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   347
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete -quiet",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   348
                        "|  Conflicting options"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   349
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -command -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   350
                        "|  Conflicting options"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   351
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -d",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   352
                        "|  No feedback mode named: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   353
                (a) -> assertCommandOutputStartsWith(a, "/set mode normal -c",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   354
                        "|  Mode to be created already exists: normal"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   355
                (a) -> assertCommand(a, "/se mo -c mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   356
                        "|  Created new feedback mode: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   357
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   358
                        "|  /set mode mymode -command"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   359
                (a) -> assertCommand(a, "/set feedback mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   360
                        "|  Feedback mode: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   361
                (a) -> assertCommand(a, "/se fe",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   362
                        "|  /set feedback mymode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   363
                        "|  \n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   364
                        "|  Available feedback modes:\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   365
                        "|     concise\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   366
                        "|     mymode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   367
                        "|     normal\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   368
                        "|     silent\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   369
                        "|     verbose"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   370
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   371
                        "|  The current feedback mode 'mymode' cannot be deleted"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   372
                (a) -> assertCommand(a, "/set feedback no",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   373
                        "|  Feedback mode: normal"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   374
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   375
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   376
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   377
                        "|  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
   378
                        "|  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
   379
                        "|  Available feedback modes:"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   380
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   381
                        (s) -> assertFalse(s.contains("mymode"), "Didn't delete: " + s))
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   382
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   383
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   384
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   385
    public void setModeSmashTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   386
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   387
                (a) -> assertCommand(a, "/set mode mymode -command",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   388
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   389
                (a) -> assertCommand(a, "/set feedback mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   390
                        "|  Feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   391
                (a) -> assertCommand(a, "/set format mymode display 'blurb'",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   392
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   393
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   394
                        "blurb"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   395
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode normal",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   396
                        "|  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
   397
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -command normal",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   398
                        "|  Mode to be created already exists: mymode"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   399
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   400
                        "|  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
   401
                (a) -> assertCommand(a, "/set feedback normal",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   402
                        "|  Feedback mode: normal"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   403
                (a) -> assertCommand(a, "/set mode mymode -delete",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   404
                        ""),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   405
                (a) -> assertCommand(a, "/set mode mymode -command normal",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   406
                        "|  Created new feedback mode: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   407
                (a) -> assertCommand(a, "/set feedback mymode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   408
                        "|  Feedback mode: mymode"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   409
                (a) -> assertCommandOutputContains(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   410
                        " ==> 45")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   411
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   412
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   413
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   414
    public void retainModeTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   415
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   416
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   417
                        "|  Missing the feedback mode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   418
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain *",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   419
                        "|  Expected a feedback mode name: *"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   420
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain amode normal",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   421
                        "|  Unexpected arguments at end of command: normal"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   422
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain mymode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   423
                        "|  No feedback mode named: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   424
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain mymode -delete",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   425
                        "|  No feedback mode named: mymode"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   426
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain -d mymode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   427
                        "|  No feedback mode named: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   428
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain normal",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   429
                        "|  Not valid with a predefined mode: normal"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   430
                (a) -> assertCommand(a, "/set mode mymode verbose -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   431
                        "|  Created new feedback mode: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   432
                (a) -> assertCommand(a, "/set mode -retain mymode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   433
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   434
                (a) -> assertCommand(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   435
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   436
                (a) -> assertCommand(a, "/set mode -retain mymode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   437
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   438
                (a) -> assertCommand(a, "/set mode kmode normal -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   439
                        "|  Created new feedback mode: kmode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   440
                (a) -> assertCommand(a, "/set mode -retain kmode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   441
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   442
                (a) -> assertCommand(a, "/set mode kmode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   443
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   444
                (a) -> assertCommand(a, "/set mode tmode normal -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   445
                        "|  Created new feedback mode: tmode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   446
                (a) -> assertCommandOutputStartsWith(a, "/set feedback -retain tmode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   447
                        "|  '/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
   448
                (a) -> assertCommand(a, "/set format tmode display 'YES'",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   449
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   450
                (a) -> assertCommand(a, "/set feedback tmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   451
                        "|  Feedback mode: tmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   452
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   453
                        "YES"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   454
                (a) -> assertCommand(a, "/set mode -retain tmode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   455
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   456
                (a) -> assertCommand(a, "/set feedback -retain tmode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   457
                        "|  Feedback mode: tmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   458
                (a) -> assertCommand(a, "/set format tmode display 'blurb'",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   459
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   460
                (a) -> assertCommand(a, "/set format tmode display",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   461
                        "|  /set format tmode display \"blurb\""),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   462
                (a) -> assertCommandOutputContains(a, "/set mode tmode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   463
                        "|  /set format tmode display \"YES\""),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   464
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   465
                        "blurb")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   466
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   467
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   468
                (a) -> assertCommand(a, "/set format tmode display",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   469
                        "|  /set format tmode display \"YES\""),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   470
                (a) -> assertCommandOutputContains(a, "/set mode tmode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   471
                        "|  /set format tmode display \"YES\""),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   472
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   473
                        "YES"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   474
                (a) -> assertCommand(a, "/set feedback kmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   475
                        "|  Feedback mode: kmode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   476
                (a) -> assertCommand(a, "/set feedback",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   477
                        "|  /set feedback -retain tmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   478
                        "|  /set feedback kmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   479
                        "|  \n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   480
                        "|  Retained feedback modes:\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   481
                        "|     kmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   482
                        "|     tmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   483
                        "|  Available feedback modes:\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   484
                        "|     concise\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   485
                        "|     kmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   486
                        "|     normal\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   487
                        "|     silent\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   488
                        "|     tmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   489
                        "|     verbose"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   490
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain kmode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   491
                        "|  The current feedback mode 'kmode' cannot be deleted"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   492
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain tmode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   493
                        "|  The retained feedback mode 'tmode' cannot be deleted"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   494
                (a) -> assertCommand(a, "/set feedback -retain normal",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   495
                        "|  Feedback mode: normal"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   496
                (a) -> assertCommand(a, "/set mode -retain tmode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   497
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   498
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain kmode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   499
                        "")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   500
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   501
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   502
                (a) -> assertCommandOutputStartsWith(a, "/set feedback tmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   503
                        "|  Does not match any current feedback mode: tmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   504
                (a) -> assertCommandOutputStartsWith(a, "/set feedback kmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   505
                        "|  Does not match any current feedback mode: kmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   506
                (a) -> assertCommandOutputStartsWith(a, "/set feedback mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   507
                        "|  Does not match any current feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   508
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   509
                        (s) -> assertFalse(s.contains("mymode"), "Didn't delete mymode: " + s)),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   510
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   511
                        (s) -> assertFalse(s.contains("kmode"), "Didn't delete kmode: " + s)),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   512
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   513
                        (s) -> assertFalse(s.contains("tmode"), "Didn't delete tmode: " + s))
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   514
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   515
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   516
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   517
}