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