langtools/test/jdk/jshell/ToolCommandOptionTest.java
author rfield
Fri, 26 Aug 2016 11:36:08 -0700
changeset 40598 821b945fc942
parent 40588 b5c32bfa9710
child 41514 a75c2b869d8d
permissions -rw-r--r--
8158738: jshell tool: Save does not affect jshell if started from another editor 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
40598
821b945fc942 8158738: jshell tool: Save does not affect jshell if started from another editor
rfield
parents: 40588
diff changeset
    26
 * @bug 8157395 8157393 8157517 8158738
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"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   104
                (a) -> assertCommandOutputStartsWith(a, "/drop 2",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   105
                        "|  This command does not accept the snippet '2' : x"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   106
                (a) -> assertCommand(a, "/dr x y",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   107
                        "|  dropped variable x\n" +
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   108
                        "|  dropped variable y"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   109
                (a) -> assertCommand(a, "/list",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   110
                        "2 : x")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   111
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   112
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   113
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   114
    public void setEditorTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   115
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   116
                (a) -> assertCommand(a, "/set editor -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   117
                        "|  Unknown option: -furball -- /set editor -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   118
                (a) -> assertCommand(a, "/set editor -furball prog",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   119
                        "|  Unknown option: -furball -- /set editor -furball prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   120
                (a) -> assertCommand(a, "/set editor -furball -mattress",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   121
                        "|  Unknown option: -furball -mattress -- /set editor -furball -mattress"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   122
                (a) -> assertCommand(a, "/set editor -default prog",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   123
                        "|  Specify -default option or program, not both -- /set editor -default prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   124
                (a) -> assertCommand(a, "/set editor prog",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   125
                        "|  Editor set to: prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   126
                (a) -> assertCommand(a, "/set editor prog -default",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   127
                        "|  Editor set to: prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   128
                (a) -> assertCommand(a, "/se ed prog -furball",
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 arg1 -furball arg3 -default arg4",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   131
                        "|  Editor set to: prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   132
                (a) -> assertCommand(a, "/set editor -default",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   133
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   134
                (a) -> assertCommand(a, "/se edi -def",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   135
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   136
                (a) -> assertCommand(a, "/set editor",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   137
                        "|  The '/set editor' command requires a path argument")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   138
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   139
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   140
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   141
    public void retainEditorTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   142
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   143
                (a) -> assertCommand(a, "/retain editor -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   144
                        "|  Unknown option: -furball -- /retain editor -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   145
                (a) -> assertCommand(a, "/retain editor -furball prog",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   146
                        "|  Unknown option: -furball -- /retain editor -furball prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   147
                (a) -> assertCommand(a, "/retain editor -furball -mattress",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   148
                        "|  Unknown option: -furball -mattress -- /retain editor -furball -mattress"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   149
                (a) -> assertCommand(a, "/retain editor -default prog",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   150
                        "|  Specify -default option or program, not both -- /retain editor -default prog"),
40598
821b945fc942 8158738: jshell tool: Save does not affect jshell if started from another editor
rfield
parents: 40588
diff changeset
   151
                (a) -> assertCommand(a, "/retain editor -default -wait",
821b945fc942 8158738: jshell tool: Save does not affect jshell if started from another editor
rfield
parents: 40588
diff changeset
   152
                        "|  -wait applies to external editors, cannot be used with -default"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   153
                (a) -> assertCommand(a, "/retain editor prog",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   154
                        "|  Editor set to: prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   155
                (a) -> assertCommand(a, "/retain editor prog -default",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   156
                        "|  Editor set to: prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   157
                (a) -> assertCommand(a, "/ret ed prog -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   158
                        "|  Editor set to: prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   159
                (a) -> assertCommand(a, "/retain editor prog arg1 -furball arg3 -default arg4",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   160
                        "|  Editor set to: prog"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   161
                (a) -> assertCommand(a, "/retain editor -default",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   162
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   163
                (a) -> assertCommand(a, "/reta edi -def",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   164
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   165
                (a) -> assertCommand(a, "/retain editor",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   166
                        "")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   167
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   168
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   169
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   170
    public void setStartTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   171
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   172
                (a) -> assertCommand(a, "/set start -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   173
                        "|  Unknown option: -furball -- /set start -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   174
                (a) -> assertCommand(a, "/set start -furball pyle",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   175
                        "|  Unknown option: -furball -- /set start -furball pyle"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   176
                (a) -> assertCommand(a, "/se st pyle -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   177
                        "|  Unknown option: -furball -- /set st pyle -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   178
                (a) -> assertCommand(a, "/set start -furball -mattress",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   179
                        "|  Unknown option: -furball -mattress -- /set start -furball -mattress"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   180
                (a) -> assertCommand(a, "/set start foo -default",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   181
                        "|  Specify either one option or a startup file name -- /set start foo -default"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   182
                (a) -> assertCommand(a, "/set start frfg",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   183
                        "|  File 'frfg' for '/set start' is not found."),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   184
                (a) -> assertCommand(a, "/set start -default",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   185
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   186
                (a) -> assertCommand(a, "/se sta -no",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   187
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   188
                (a) -> assertCommand(a, "/set start",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   189
                        "|  Specify either one option or a startup file name -- /set start")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   190
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   191
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   192
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   193
    public void retainStartTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   194
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   195
                (a) -> assertCommand(a, "/retain start -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   196
                        "|  Unknown option: -furball -- /retain start -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   197
                (a) -> assertCommand(a, "/retain start -furball pyle",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   198
                        "|  Unknown option: -furball -- /retain start -furball pyle"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   199
                (a) -> assertCommand(a, "/ret st pyle -furball",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   200
                        "|  Unknown option: -furball -- /retain st pyle -furball"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   201
                (a) -> assertCommand(a, "/retain start -furball -mattress",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   202
                        "|  Unknown option: -furball -mattress -- /retain start -furball -mattress"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   203
                (a) -> assertCommand(a, "/retain start foo -default",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   204
                        "|  Specify either one option or a startup file name -- /retain start foo -default"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   205
                (a) -> assertCommand(a, "/retain start frfg",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   206
                        "|  File 'frfg' for '/retain start' is not found."),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   207
                (a) -> assertCommand(a, "/retain start -default",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   208
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   209
                (a) -> assertCommand(a, "/ret sta -no",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   210
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   211
                (a) -> assertCommand(a, "/retain start",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   212
                        "")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   213
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   214
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   215
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   216
    public void setModeTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   217
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   218
                (a) -> assertCommandOutputStartsWith(a, "/set mode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   219
                        "|  Missing the feedback mode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   220
                (a) -> assertCommandOutputStartsWith(a, "/set mode *",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   221
                        "|  Expected a feedback mode name: *"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   222
                (a) -> assertCommandOutputStartsWith(a, "/set mode -quiet",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   223
                        "|  Missing the feedback mode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   224
                (a) -> assertCommandOutputStartsWith(a, "/set mode -quiet *",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   225
                        "|  Expected a feedback mode name: *"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   226
                (a) -> assertCommandOutputStartsWith(a, "/set mode amode normal thing",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   227
                        "|  Unexpected arguments at end of command: thing"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   228
                (a) -> assertCommand(a, "/set mode mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   229
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   230
                (a) -> assertCommand(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   231
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   232
                (a) -> assertCommand(a, "/set mode mymode normal",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   233
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   234
                (a) -> assertCommand(a, "/set mode -del mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   235
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   236
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -command -quiet",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   237
                        "|  Conflicting options"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   238
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete -quiet",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   239
                        "|  Conflicting options"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   240
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -command -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   241
                        "|  Conflicting options"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   242
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -d",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   243
                        "|  No feedback mode named: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   244
                (a) -> assertCommandOutputStartsWith(a, "/set mode normal",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   245
                        "|  Not valid with a predefined mode: normal"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   246
                (a) -> assertCommand(a, "/se mo -c mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   247
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   248
                (a) -> assertCommand(a, "/set feedback mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   249
                        "|  Feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   250
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   251
                        "|  The current feedback mode 'mymode' cannot be deleted"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   252
                (a) -> assertCommand(a, "/set feedback no",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   253
                        "|  Feedback mode: normal"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   254
                (a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   255
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   256
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   257
                        (s) -> assertFalse(s.contains("mymode"), "Didn't delete: " + s))
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   258
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   259
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   260
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   261
    public void setModeSmashTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   262
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   263
                (a) -> assertCommand(a, "/set mode mymode -command",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   264
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   265
                (a) -> assertCommand(a, "/set feedback mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   266
                        "|  Feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   267
                (a) -> assertCommand(a, "/set format mymode display 'blurb'",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   268
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   269
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   270
                        "blurb"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   271
                (a) -> assertCommand(a, "/set mode mymode normal",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   272
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   273
                (a) -> assertCommandOutputContains(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   274
                        " ==> 45")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   275
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   276
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   277
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   278
    public void retainModeTest() {
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   279
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   280
                (a) -> assertCommandOutputStartsWith(a, "/retain mode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   281
                        "|  Missing the feedback mode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   282
                (a) -> assertCommandOutputStartsWith(a, "/retain mode *",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   283
                        "|  Expected a feedback mode name: *"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   284
                (a) -> assertCommandOutputStartsWith(a, "/retain mode amode normal",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   285
                        "|  Unexpected arguments at end of command: normal"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   286
                (a) -> assertCommandOutputStartsWith(a, "/retain mode mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   287
                        "|  Does not match any current feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   288
                (a) -> assertCommandOutputStartsWith(a, "/retain mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   289
                        "|  No feedback mode named: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   290
                (a) -> assertCommandOutputStartsWith(a, "/retain mode -d mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   291
                        "|  No feedback mode named: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   292
                (a) -> assertCommandOutputStartsWith(a, "/retain mode normal",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   293
                        "|  Not valid with a predefined mode: normal"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   294
                (a) -> assertCommand(a, "/set mode mymode verbose",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   295
                        "|  Created new feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   296
                (a) -> assertCommand(a, "/retain mode mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   297
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   298
                (a) -> assertCommand(a, "/set mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   299
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   300
                (a) -> assertCommand(a, "/retain mode mymode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   301
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   302
                (a) -> assertCommand(a, "/set mode kmode normal",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   303
                        "|  Created new feedback mode: kmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   304
                (a) -> assertCommand(a, "/retain mode kmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   305
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   306
                (a) -> assertCommand(a, "/set mode kmode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   307
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   308
                (a) -> assertCommand(a, "/set mode tmode normal",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   309
                        "|  Created new feedback mode: tmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   310
                (a) -> assertCommandOutputStartsWith(a, "/retain feedback tmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   311
                        "|  '/retain feedback <mode>' requires that <mode> is predefined or has been retained with '/retain mode'"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   312
                (a) -> assertCommand(a, "/set format tmode display 'YES'",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   313
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   314
                (a) -> assertCommand(a, "/set feedback tmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   315
                        "|  Feedback mode: tmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   316
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   317
                        "YES"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   318
                (a) -> assertCommand(a, "/retain mode tmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   319
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   320
                (a) -> assertCommand(a, "/retain feedback tmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   321
                        "|  Feedback mode: tmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   322
                (a) -> assertCommand(a, "/set format tmode display 'blurb'",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   323
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   324
                (a) -> assertCommand(a, "45",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   325
                        "blurb")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   326
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   327
        test(
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
                        "YES"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   330
                (a) -> assertCommand(a, "/set feedback kmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   331
                        "|  Feedback mode: kmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   332
                (a) -> assertCommandOutputStartsWith(a, "/retain mode kmode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   333
                        "|  The current feedback mode 'kmode' cannot be deleted"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   334
                (a) -> assertCommandOutputStartsWith(a, "/retain mode tmode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   335
                        "|  The retained feedback mode 'tmode' cannot be deleted"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   336
                (a) -> assertCommand(a, "/retain feedback normal",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   337
                        "|  Feedback mode: normal"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   338
                (a) -> assertCommand(a, "/retain mode tmode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   339
                        ""),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   340
                (a) -> assertCommandOutputStartsWith(a, "/retain mode kmode -delete",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   341
                        "")
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   342
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   343
        test(
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   344
                (a) -> assertCommandOutputStartsWith(a, "/set feedback tmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   345
                        "|  Does not match any current feedback mode: tmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   346
                (a) -> assertCommandOutputStartsWith(a, "/set feedback kmode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   347
                        "|  Does not match any current feedback mode: kmode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   348
                (a) -> assertCommandOutputStartsWith(a, "/set feedback mymode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   349
                        "|  Does not match any current feedback mode: mymode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   350
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   351
                        (s) -> assertFalse(s.contains("mymode"), "Didn't delete mymode: " + s)),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   352
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   353
                        (s) -> assertFalse(s.contains("kmode"), "Didn't delete kmode: " + s)),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   354
                (a) -> assertCommandCheckOutput(a, "/set feedback",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   355
                        (s) -> assertFalse(s.contains("tmode"), "Didn't delete tmode: " + s))
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   356
        );
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   357
    }
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   358
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents:
diff changeset
   359
}