langtools/test/jdk/jshell/ToolCommandOptionTest.java
author rfield
Thu, 20 Oct 2016 12:53:11 -0700
changeset 41635 cb3d04878117
parent 41514 a75c2b869d8d
child 41641 a628785b9dd9
permissions -rw-r--r--
8163840: jshell tool: provide way to display configuration settings 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
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
    26
 * @bug 8157395 8157393 8157517 8158738 8167128 8163840
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
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    29
 * @build ToolCommandOptionTest ReplToolTesting
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    30
 * @run testng ToolCommandOptionTest
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    31
 */
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    32
import org.testng.annotations.Test;
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    33
import static org.testng.Assert.assertFalse;
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    34
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    35
@Test
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    36
public class ToolCommandOptionTest extends ReplToolTesting {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    37
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    38
    public void listTest() {
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
                (a) -> assertCommand(a, "int x;",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    41
                        "x ==> 0"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    42
                (a) -> assertCommand(a, "/li",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    43
                        "1 : int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    44
                (a) -> assertCommandOutputStartsWith(a, "/lis -st",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    45
                        "\n  s1 : import"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    46
                (a) -> assertCommandOutputStartsWith(a, "/list -all",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    47
                        "\n  s1 : import"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    48
                (a) -> assertCommandOutputContains(a, "/list -all",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    49
                        "1 : int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    50
                (a) -> assertCommandOutputContains(a, "/list -history",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    51
                        "int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    52
                (a) -> assertCommandOutputContains(a, "/li -h",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    53
                        "/lis -st"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    54
                (a) -> assertCommand(a, "/list -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    55
                        "|  Unknown option: -furball -- /list -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    56
                (a) -> assertCommand(a, "/list x",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    57
                        "1 : int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    58
                (a) -> assertCommand(a, "/li x -start",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    59
                        "|  Options and snippets must not both be used: /list x -start"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    60
                (a) -> assertCommand(a, "/l -st -al",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    61
                        "|  Conflicting options -- /list -st -al")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    62
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    63
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    64
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    65
    public void typesTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    66
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    67
                (a) -> assertCommand(a, "int x",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    68
                        "x ==> 0"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    69
                (a) -> assertCommand(a, "/types x",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    70
                        "|  This command does not accept the snippet 'x' : int x;"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    71
                (a) -> assertCommand(a, "class C {}",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    72
                        "|  created class C"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    73
                (a) -> assertCommand(a, "/ty",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    74
                        "|    class C"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    75
                (a) -> assertCommand(a, "/ty -st",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    76
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    77
                (a) -> assertCommand(a, "/types -all",
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, "/types -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    80
                        "|  Unknown option: -furball -- /types -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    81
                (a) -> assertCommand(a, "/types C",
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 C -start",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    84
                        "|  Options and snippets must not both be used: /types C -start"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    85
                (a) -> assertCommand(a, "/ty -st -al",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    86
                        "|  Conflicting options -- /types -st -al")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    87
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    88
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    89
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    90
    public void dropTest() {
40588
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38539
diff changeset
    91
        test(false, new String[]{"--no-startup"},
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    92
                (a) -> assertCommand(a, "int x = 5;",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    93
                        "x ==> 5"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    94
                (a) -> assertCommand(a, "x",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    95
                        "x ==> 5"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    96
                (a) -> assertCommand(a, "long y;",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    97
                        "y ==> 0"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    98
                (a) -> assertCommand(a, "/drop -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
    99
                        "|  Unknown option: -furball -- /drop -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   100
                (a) -> assertCommand(a, "/drop -all",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   101
                        "|  Unknown option: -all -- /drop -all"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   102
                (a) -> assertCommandOutputStartsWith(a, "/drop z",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   103
                        "|  No such snippet: z"),
41514
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   104
                (a) -> assertCommand(a, "/drop 2",
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   105
                        ""),
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   106
                (a) -> assertCommandOutputStartsWith(a, "23qwl",
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   107
                        "|  Error:"),
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   108
                (a) -> assertCommandOutputStartsWith(a, "/drop e1",
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   109
                        "|  This command does not accept the snippet 'e1' : 23qwl"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   110
                (a) -> assertCommand(a, "/dr x y",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   111
                        "|  dropped variable x\n" +
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   112
                        "|  dropped variable y"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   113
                (a) -> assertCommand(a, "/list",
41514
a75c2b869d8d 8167128: JShell: /drop of statement gives confusing output
rfield
parents: 40598
diff changeset
   114
                        "")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   115
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   116
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   117
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   118
    public void setEditorTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   119
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   120
                (a) -> assertCommand(a, "/set editor -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   121
                        "|  Unknown option: -furball -- /set editor -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   122
                (a) -> assertCommand(a, "/set editor -furball prog",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   123
                        "|  Unknown option: -furball -- /set editor -furball prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   124
                (a) -> assertCommand(a, "/set editor -furball -mattress",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   125
                        "|  Unknown option: -furball -mattress -- /set editor -furball -mattress"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   126
                (a) -> assertCommand(a, "/set editor -default prog",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   127
                        "|  Specify -default option or program, not both -- /set editor -default prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   128
                (a) -> assertCommand(a, "/set editor prog",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   129
                        "|  Editor set to: prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   130
                (a) -> assertCommand(a, "/set editor prog -default",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   131
                        "|  Editor set to: prog -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   132
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   133
                        "|  /set editor prog -default"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   134
                (a) -> assertCommand(a, "/se ed prog -furball",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   135
                        "|  Editor set to: prog -furball"),
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 -furball"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   138
                (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
   139
                        "|  Editor set to: prog arg1 -furball arg3 -default arg4"),
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 arg1 -furball arg3 -default arg4"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   142
                (a) -> assertCommand(a, "/set editor -default",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   143
                        "|  Editor set to: -default"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   144
                (a) -> assertCommand(a, "/se edi -def",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   145
                        "|  Editor set to: -default"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   146
                (a) -> assertCommand(a, "/set editor",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   147
                        "|  /set editor -default")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   148
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   149
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   150
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   151
    public void retainEditorTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   152
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   153
                (a) -> assertCommand(a, "/set editor -retain -furball",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   154
                        "|  Unknown option: -furball -- /set editor -retain -furball"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   155
                (a) -> assertCommand(a, "/set editor -retain -furball prog",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   156
                        "|  Unknown option: -furball -- /set editor -retain -furball prog"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   157
                (a) -> assertCommand(a, "/set editor -retain -furball -mattress",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   158
                        "|  Unknown option: -furball -mattress -- /set editor -retain -furball -mattress"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   159
                (a) -> assertCommand(a, "/set editor -retain -default prog",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   160
                        "|  Specify -default option or program, not both -- /set editor -retain -default prog"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   161
                (a) -> assertCommand(a, "/set editor -retain -wait",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   162
                        "|  -wait applies to external editors"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   163
                (a) -> assertCommand(a, "/set editor -retain -default -wait",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   164
                        "|  -wait applies to external editors"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   165
                (a) -> assertCommand(a, "/set editor -retain prog",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   166
                        "|  Editor set to: prog\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   167
                        "|  Editor setting retained: prog"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   168
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   169
                        "|  /set editor -retain prog"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   170
                (a) -> assertCommand(a, "/se ed other",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   171
                        "|  Editor set to: other"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   172
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   173
                        "|  /set editor -retain prog\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   174
                        "|  /set editor other"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   175
                (a) -> assertCommand(a, "/set editor -retain prog -default",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   176
                        "|  Editor set to: prog -default\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   177
                        "|  Editor setting retained: prog -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   178
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   179
                        "|  /set editor -retain prog -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   180
                (a) -> assertCommand(a, "/se ed -retain prog -furball",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   181
                        "|  Editor set to: prog -furball\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   182
                        "|  Editor setting retained: prog -furball"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   183
                (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
   184
                        "|  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
   185
                        "|  Editor setting retained: prog arg1 -furball arg3 -default arg4"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   186
                (a) -> assertCommand(a, "/set editor",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   187
                        "|  /set editor -retain prog arg1 -furball arg3 -default arg4"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   188
                (a) -> assertCommand(a, "/set editor -retain -default",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   189
                        "|  Editor set to: -default\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   190
                        "|  Editor setting retained: -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 -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   193
                (a) -> assertCommand(a, "/se e -ret -def",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   194
                        "|  Editor set to: -default\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   195
                        "|  Editor setting retained: -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   196
                (a) -> assertCommand(a, "/set editor -retain",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   197
                        "|  Editor setting retained: -default")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   198
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   199
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   200
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   201
    public void setStartTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   202
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   203
                (a) -> assertCommand(a, "/set start -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   204
                        "|  Unknown option: -furball -- /set start -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   205
                (a) -> assertCommand(a, "/set start -furball pyle",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   206
                        "|  Unknown option: -furball -- /set start -furball pyle"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   207
                (a) -> assertCommand(a, "/se st pyle -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   208
                        "|  Unknown option: -furball -- /set st pyle -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   209
                (a) -> assertCommand(a, "/set start -furball -mattress",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   210
                        "|  Unknown option: -furball -mattress -- /set start -furball -mattress"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   211
                (a) -> assertCommand(a, "/set start foo -default",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   212
                        "|  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
   213
                (a) -> assertCommand(a, "/set start frfg",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   214
                        "|  File 'frfg' for '/set start' is not found."),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   215
                (a) -> assertCommand(a, "/set start -default",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   216
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   217
                (a) -> assertCommand(a, "/set start",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   218
                        "|  /set start -default"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   219
                (a) -> assertCommand(a, "/se sta -no",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   220
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   221
                (a) -> assertCommand(a, "/set start",
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   222
                        "|  /set start -none")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   223
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   224
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   225
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   226
    public void retainStartTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   227
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   228
                (a) -> assertCommand(a, "/set start -retain -furball",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   229
                        "|  Unknown option: -furball -- /set start -retain -furball"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   230
                (a) -> assertCommand(a, "/set start -retain -furball pyle",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   231
                        "|  Unknown option: -furball -- /set start -retain -furball pyle"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   232
                (a) -> assertCommand(a, "/se st -re pyle -furball",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   233
                        "|  Unknown option: -furball -- /set st -re pyle -furball"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   234
                (a) -> assertCommand(a, "/set start -retain -furball -mattress",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   235
                        "|  Unknown option: -furball -mattress -- /set start -retain -furball -mattress"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   236
                (a) -> assertCommand(a, "/set start -retain foo -default",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   237
                        "|  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
   238
                (a) -> assertCommand(a, "/set start -retain -default foo",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   239
                        "|  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
   240
                (a) -> assertCommand(a, "/set start -retain frfg",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   241
                        "|  File 'frfg' for '/set start' is not found."),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   242
                (a) -> assertCommand(a, "/set start -retain -default",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   243
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   244
                (a) -> assertCommand(a, "/set start",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   245
                        "|  /set start -retain -default"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   246
                (a) -> assertCommand(a, "/set sta -no",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   247
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   248
                (a) -> assertCommand(a, "/set start",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   249
                        "|  /set start -retain -default\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   250
                        "|  /set start -none"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   251
                (a) -> assertCommand(a, "/se st -ret",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   252
                        ""),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   253
                (a) -> assertCommand(a, "/se sta",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   254
                        "|  /set start -retain -none")
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   255
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   256
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   257
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   258
    public void setModeTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   259
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   260
                (a) -> assertCommandOutputContains(a, "/set mode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   261
                        "|  /set format verbose unresolved"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   262
                (a) -> assertCommandOutputStartsWith(a, "/set mode *",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   263
                        "|  Expected a feedback mode name: *"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   264
                (a) -> assertCommandOutputStartsWith(a, "/set mode -quiet",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   265
                        "|  Missing the feedback mode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   266
                (a) -> assertCommandOutputStartsWith(a, "/set mode -quiet *",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   267
                        "|  Expected a feedback mode name: *"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   268
                (a) -> assertCommandOutputStartsWith(a, "/set mode amode normal thing",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   269
                        "|  Unexpected arguments at end of command: thing"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   270
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   271
                        "|  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
   272
                (a) -> assertCommand(a, "/set mode mymode -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   273
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   274
                (a) -> assertCommand(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   275
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   276
                (a) -> assertCommand(a, "/set mode mymode normal -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   277
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   278
                (a) -> assertCommand(a, "/set mode -del mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   279
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   280
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -command -quiet",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   281
                        "|  Conflicting options"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   282
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete -quiet",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   283
                        "|  Conflicting options"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   284
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -command -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   285
                        "|  Conflicting options"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   286
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -d",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   287
                        "|  No feedback mode named: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   288
                (a) -> assertCommandOutputStartsWith(a, "/set mode normal -c",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   289
                        "|  Mode to be created already exists: normal"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   290
                (a) -> assertCommand(a, "/se mo -c mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   291
                        "|  Created new feedback mode: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   292
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   293
                        "|  /set mode mymode -command"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   294
                (a) -> assertCommand(a, "/set feedback mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   295
                        "|  Feedback mode: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   296
                (a) -> assertCommand(a, "/se fe",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   297
                        "|  /set feedback mymode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   298
                        "|  \n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   299
                        "|  Available feedback modes:\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   300
                        "|     concise\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   301
                        "|     mymode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   302
                        "|     normal\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   303
                        "|     silent\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   304
                        "|     verbose"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   305
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   306
                        "|  The current feedback mode 'mymode' cannot be deleted"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   307
                (a) -> assertCommand(a, "/set feedback no",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   308
                        "|  Feedback mode: normal"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   309
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   310
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   311
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   312
                        "|  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
   313
                        "|  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
   314
                        "|  Available feedback modes:"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   315
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   316
                        (s) -> assertFalse(s.contains("mymode"), "Didn't delete: " + s))
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   317
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   318
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   319
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   320
    public void setModeSmashTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   321
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   322
                (a) -> assertCommand(a, "/set mode mymode -command",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   323
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   324
                (a) -> assertCommand(a, "/set feedback mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   325
                        "|  Feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   326
                (a) -> assertCommand(a, "/set format mymode display 'blurb'",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   327
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   328
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   329
                        "blurb"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   330
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode normal",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   331
                        "|  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
   332
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -command normal",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   333
                        "|  Mode to be created already exists: mymode"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   334
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   335
                        "|  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
   336
                (a) -> assertCommand(a, "/set feedback normal",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   337
                        "|  Feedback mode: normal"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   338
                (a) -> assertCommand(a, "/set mode mymode -delete",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   339
                        ""),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   340
                (a) -> assertCommand(a, "/set mode mymode -command normal",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   341
                        "|  Created new feedback mode: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   342
                (a) -> assertCommand(a, "/set feedback mymode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   343
                        "|  Feedback mode: mymode"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   344
                (a) -> assertCommandOutputContains(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   345
                        " ==> 45")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   346
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   347
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   348
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   349
    public void retainModeTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   350
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   351
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   352
                        "|  Missing the feedback mode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   353
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain *",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   354
                        "|  Expected a feedback mode name: *"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   355
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain amode normal",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   356
                        "|  Unexpected arguments at end of command: normal"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   357
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain mymode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   358
                        "|  No feedback mode named: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   359
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain mymode -delete",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   360
                        "|  No feedback mode named: mymode"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   361
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain -d mymode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   362
                        "|  No feedback mode named: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   363
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain normal",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   364
                        "|  Not valid with a predefined mode: normal"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   365
                (a) -> assertCommand(a, "/set mode mymode verbose -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   366
                        "|  Created new feedback mode: mymode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   367
                (a) -> assertCommand(a, "/set mode -retain mymode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   368
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   369
                (a) -> assertCommand(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   370
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   371
                (a) -> assertCommand(a, "/set mode -retain mymode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   372
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   373
                (a) -> assertCommand(a, "/set mode kmode normal -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   374
                        "|  Created new feedback mode: kmode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   375
                (a) -> assertCommand(a, "/set mode -retain kmode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   376
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   377
                (a) -> assertCommand(a, "/set mode kmode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   378
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   379
                (a) -> assertCommand(a, "/set mode tmode normal -command",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   380
                        "|  Created new feedback mode: tmode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   381
                (a) -> assertCommandOutputStartsWith(a, "/set feedback -retain tmode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   382
                        "|  '/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
   383
                (a) -> assertCommand(a, "/set format tmode display 'YES'",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   384
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   385
                (a) -> assertCommand(a, "/set feedback tmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   386
                        "|  Feedback mode: tmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   387
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   388
                        "YES"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   389
                (a) -> assertCommand(a, "/set mode -retain tmode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   390
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   391
                (a) -> assertCommand(a, "/set feedback -retain tmode",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   392
                        "|  Feedback mode: tmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   393
                (a) -> assertCommand(a, "/set format tmode display 'blurb'",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   394
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   395
                (a) -> assertCommand(a, "/set format tmode display",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   396
                        "|  /set format tmode display \"blurb\""),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   397
                (a) -> assertCommandOutputContains(a, "/set mode tmode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   398
                        "|  /set format tmode display \"YES\""),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   399
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   400
                        "blurb")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   401
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   402
        test(
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   403
                (a) -> assertCommand(a, "/set format tmode display",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   404
                        "|  /set format tmode display \"YES\""),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   405
                (a) -> assertCommandOutputContains(a, "/set mode tmode",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   406
                        "|  /set format tmode display \"YES\""),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   407
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   408
                        "YES"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   409
                (a) -> assertCommand(a, "/set feedback kmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   410
                        "|  Feedback mode: kmode"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   411
                (a) -> assertCommand(a, "/set feedback",
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   412
                        "|  /set feedback -retain tmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   413
                        "|  /set feedback kmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   414
                        "|  \n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   415
                        "|  Retained feedback modes:\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   416
                        "|     kmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   417
                        "|     tmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   418
                        "|  Available feedback modes:\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   419
                        "|     concise\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   420
                        "|     kmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   421
                        "|     normal\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   422
                        "|     silent\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   423
                        "|     tmode\n" +
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   424
                        "|     verbose"),
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   425
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain kmode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   426
                        "|  The current feedback mode 'kmode' cannot be deleted"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   427
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain tmode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   428
                        "|  The retained feedback mode 'tmode' cannot be deleted"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   429
                (a) -> assertCommand(a, "/set feedback -retain normal",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   430
                        "|  Feedback mode: normal"),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   431
                (a) -> assertCommand(a, "/set mode -retain tmode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   432
                        ""),
41635
cb3d04878117 8163840: jshell tool: provide way to display configuration settings
rfield
parents: 41514
diff changeset
   433
                (a) -> assertCommandOutputStartsWith(a, "/set mode -retain kmode -delete",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   434
                        "")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   435
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   436
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   437
                (a) -> assertCommandOutputStartsWith(a, "/set feedback tmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   438
                        "|  Does not match any current feedback mode: tmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   439
                (a) -> assertCommandOutputStartsWith(a, "/set feedback kmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   440
                        "|  Does not match any current feedback mode: kmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   441
                (a) -> assertCommandOutputStartsWith(a, "/set feedback mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   442
                        "|  Does not match any current feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   443
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   444
                        (s) -> assertFalse(s.contains("mymode"), "Didn't delete mymode: " + s)),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   445
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   446
                        (s) -> assertFalse(s.contains("kmode"), "Didn't delete kmode: " + s)),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   447
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   448
                        (s) -> assertFalse(s.contains("tmode"), "Didn't delete tmode: " + s))
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   449
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   450
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   451
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   452
}