author | rfield |
Thu, 20 Oct 2016 12:53:11 -0700 | |
changeset 41635 | cb3d04878117 |
parent 41514 | a75c2b869d8d |
child 41641 | a628785b9dd9 |
permissions | -rw-r--r-- |
38539 | 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 |
|
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 | 27 |
* @summary Tests of jshell comand options, and undoing operations |
28 |
* @modules jdk.jshell/jdk.internal.jshell.tool |
|
29 |
* @build ToolCommandOptionTest ReplToolTesting |
|
30 |
* @run testng ToolCommandOptionTest |
|
31 |
*/ |
|
32 |
import org.testng.annotations.Test; |
|
33 |
import static org.testng.Assert.assertFalse; |
|
34 |
||
35 |
@Test |
|
36 |
public class ToolCommandOptionTest extends ReplToolTesting { |
|
37 |
||
38 |
public void listTest() { |
|
39 |
test( |
|
40 |
(a) -> assertCommand(a, "int x;", |
|
41 |
"x ==> 0"), |
|
42 |
(a) -> assertCommand(a, "/li", |
|
43 |
"1 : int x;"), |
|
44 |
(a) -> assertCommandOutputStartsWith(a, "/lis -st", |
|
45 |
"\n s1 : import"), |
|
46 |
(a) -> assertCommandOutputStartsWith(a, "/list -all", |
|
47 |
"\n s1 : import"), |
|
48 |
(a) -> assertCommandOutputContains(a, "/list -all", |
|
49 |
"1 : int x;"), |
|
50 |
(a) -> assertCommandOutputContains(a, "/list -history", |
|
51 |
"int x;"), |
|
52 |
(a) -> assertCommandOutputContains(a, "/li -h", |
|
53 |
"/lis -st"), |
|
54 |
(a) -> assertCommand(a, "/list -furball", |
|
55 |
"| Unknown option: -furball -- /list -furball"), |
|
56 |
(a) -> assertCommand(a, "/list x", |
|
57 |
"1 : int x;"), |
|
58 |
(a) -> assertCommand(a, "/li x -start", |
|
59 |
"| Options and snippets must not both be used: /list x -start"), |
|
60 |
(a) -> assertCommand(a, "/l -st -al", |
|
61 |
"| Conflicting options -- /list -st -al") |
|
62 |
); |
|
63 |
} |
|
64 |
||
65 |
public void typesTest() { |
|
66 |
test( |
|
67 |
(a) -> assertCommand(a, "int x", |
|
68 |
"x ==> 0"), |
|
69 |
(a) -> assertCommand(a, "/types x", |
|
70 |
"| This command does not accept the snippet 'x' : int x;"), |
|
71 |
(a) -> assertCommand(a, "class C {}", |
|
72 |
"| created class C"), |
|
73 |
(a) -> assertCommand(a, "/ty", |
|
74 |
"| class C"), |
|
75 |
(a) -> assertCommand(a, "/ty -st", |
|
76 |
""), |
|
77 |
(a) -> assertCommand(a, "/types -all", |
|
78 |
"| class C"), |
|
79 |
(a) -> assertCommand(a, "/types -furball", |
|
80 |
"| Unknown option: -furball -- /types -furball"), |
|
81 |
(a) -> assertCommand(a, "/types C", |
|
82 |
"| class C"), |
|
83 |
(a) -> assertCommand(a, "/types C -start", |
|
84 |
"| Options and snippets must not both be used: /types C -start"), |
|
85 |
(a) -> assertCommand(a, "/ty -st -al", |
|
86 |
"| Conflicting options -- /types -st -al") |
|
87 |
); |
|
88 |
} |
|
89 |
||
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 | 92 |
(a) -> assertCommand(a, "int x = 5;", |
93 |
"x ==> 5"), |
|
94 |
(a) -> assertCommand(a, "x", |
|
95 |
"x ==> 5"), |
|
96 |
(a) -> assertCommand(a, "long y;", |
|
97 |
"y ==> 0"), |
|
98 |
(a) -> assertCommand(a, "/drop -furball", |
|
99 |
"| Unknown option: -furball -- /drop -furball"), |
|
100 |
(a) -> assertCommand(a, "/drop -all", |
|
101 |
"| Unknown option: -all -- /drop -all"), |
|
102 |
(a) -> assertCommandOutputStartsWith(a, "/drop z", |
|
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 | 110 |
(a) -> assertCommand(a, "/dr x y", |
111 |
"| dropped variable x\n" + |
|
112 |
"| dropped variable y"), |
|
113 |
(a) -> assertCommand(a, "/list", |
|
41514
a75c2b869d8d
8167128: JShell: /drop of statement gives confusing output
rfield
parents:
40598
diff
changeset
|
114 |
"") |
38539 | 115 |
); |
116 |
} |
|
117 |
||
118 |
public void setEditorTest() { |
|
119 |
test( |
|
120 |
(a) -> assertCommand(a, "/set editor -furball", |
|
121 |
"| Unknown option: -furball -- /set editor -furball"), |
|
122 |
(a) -> assertCommand(a, "/set editor -furball prog", |
|
123 |
"| Unknown option: -furball -- /set editor -furball prog"), |
|
124 |
(a) -> assertCommand(a, "/set editor -furball -mattress", |
|
125 |
"| Unknown option: -furball -mattress -- /set editor -furball -mattress"), |
|
126 |
(a) -> assertCommand(a, "/set editor -default prog", |
|
127 |
"| Specify -default option or program, not both -- /set editor -default prog"), |
|
128 |
(a) -> assertCommand(a, "/set editor prog", |
|
129 |
"| Editor set to: prog"), |
|
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 | 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 | 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 | 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 | 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 | 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 | 148 |
); |
149 |
} |
|
150 |
||
151 |
public void retainEditorTest() { |
|
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 | 198 |
); |
199 |
} |
|
200 |
||
201 |
public void setStartTest() { |
|
202 |
test( |
|
203 |
(a) -> assertCommand(a, "/set start -furball", |
|
204 |
"| Unknown option: -furball -- /set start -furball"), |
|
205 |
(a) -> assertCommand(a, "/set start -furball pyle", |
|
206 |
"| Unknown option: -furball -- /set start -furball pyle"), |
|
207 |
(a) -> assertCommand(a, "/se st pyle -furball", |
|
208 |
"| Unknown option: -furball -- /set st pyle -furball"), |
|
209 |
(a) -> assertCommand(a, "/set start -furball -mattress", |
|
210 |
"| Unknown option: -furball -mattress -- /set start -furball -mattress"), |
|
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 | 213 |
(a) -> assertCommand(a, "/set start frfg", |
214 |
"| File 'frfg' for '/set start' is not found."), |
|
215 |
(a) -> assertCommand(a, "/set start -default", |
|
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 | 219 |
(a) -> assertCommand(a, "/se sta -no", |
220 |
""), |
|
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 | 223 |
); |
224 |
} |
|
225 |
||
226 |
public void retainStartTest() { |
|
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 | 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 | 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 | 255 |
); |
256 |
} |
|
257 |
||
258 |
public void setModeTest() { |
|
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 | 262 |
(a) -> assertCommandOutputStartsWith(a, "/set mode *", |
263 |
"| Expected a feedback mode name: *"), |
|
264 |
(a) -> assertCommandOutputStartsWith(a, "/set mode -quiet", |
|
265 |
"| Missing the feedback mode"), |
|
266 |
(a) -> assertCommandOutputStartsWith(a, "/set mode -quiet *", |
|
267 |
"| Expected a feedback mode name: *"), |
|
268 |
(a) -> assertCommandOutputStartsWith(a, "/set mode amode normal thing", |
|
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 | 273 |
"| Created new feedback mode: mymode"), |
274 |
(a) -> assertCommand(a, "/set mode mymode -delete", |
|
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 | 277 |
"| Created new feedback mode: mymode"), |
278 |
(a) -> assertCommand(a, "/set mode -del mymode", |
|
279 |
""), |
|
280 |
(a) -> assertCommandOutputStartsWith(a, "/set mode mymode -command -quiet", |
|
281 |
"| Conflicting options"), |
|
282 |
(a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete -quiet", |
|
283 |
"| Conflicting options"), |
|
284 |
(a) -> assertCommandOutputStartsWith(a, "/set mode mymode -command -delete", |
|
285 |
"| Conflicting options"), |
|
286 |
(a) -> assertCommandOutputStartsWith(a, "/set mode mymode -d", |
|
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 | 290 |
(a) -> assertCommand(a, "/se mo -c mymode", |
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 | 294 |
(a) -> assertCommand(a, "/set feedback mymode", |
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 | 305 |
(a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete", |
306 |
"| The current feedback mode 'mymode' cannot be deleted"), |
|
307 |
(a) -> assertCommand(a, "/set feedback no", |
|
308 |
"| Feedback mode: normal"), |
|
309 |
(a) -> assertCommandOutputStartsWith(a, "/set mode mymode -delete", |
|
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 | 315 |
(a) -> assertCommandCheckOutput(a, "/set feedback", |
316 |
(s) -> assertFalse(s.contains("mymode"), "Didn't delete: " + s)) |
|
317 |
); |
|
318 |
} |
|
319 |
||
320 |
public void setModeSmashTest() { |
|
321 |
test( |
|
322 |
(a) -> assertCommand(a, "/set mode mymode -command", |
|
323 |
"| Created new feedback mode: mymode"), |
|
324 |
(a) -> assertCommand(a, "/set feedback mymode", |
|
325 |
"| Feedback mode: mymode"), |
|
326 |
(a) -> assertCommand(a, "/set format mymode display 'blurb'", |
|
327 |
""), |
|
328 |
(a) -> assertCommand(a, "45", |
|
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 | 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 | 344 |
(a) -> assertCommandOutputContains(a, "45", |
345 |
" ==> 45") |
|
346 |
); |
|
347 |
} |
|
348 |
||
349 |
public void retainModeTest() { |
|
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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 368 |
""), |
369 |
(a) -> assertCommand(a, "/set mode mymode -delete", |
|
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 | 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 | 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 | 376 |
""), |
377 |
(a) -> assertCommand(a, "/set mode kmode -delete", |
|
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 | 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 | 383 |
(a) -> assertCommand(a, "/set format tmode display 'YES'", |
384 |
""), |
|
385 |
(a) -> assertCommand(a, "/set feedback tmode", |
|
386 |
"| Feedback mode: tmode"), |
|
387 |
(a) -> assertCommand(a, "45", |
|
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 | 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 | 392 |
"| Feedback mode: tmode"), |
393 |
(a) -> assertCommand(a, "/set format tmode display 'blurb'", |
|
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 | 399 |
(a) -> assertCommand(a, "45", |
400 |
"blurb") |
|
401 |
); |
|
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 | 407 |
(a) -> assertCommand(a, "45", |
408 |
"YES"), |
|
409 |
(a) -> assertCommand(a, "/set feedback kmode", |
|
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 | 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 | 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 | 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 | 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 | 434 |
"") |
435 |
); |
|
436 |
test( |
|
437 |
(a) -> assertCommandOutputStartsWith(a, "/set feedback tmode", |
|
438 |
"| Does not match any current feedback mode: tmode"), |
|
439 |
(a) -> assertCommandOutputStartsWith(a, "/set feedback kmode", |
|
440 |
"| Does not match any current feedback mode: kmode"), |
|
441 |
(a) -> assertCommandOutputStartsWith(a, "/set feedback mymode", |
|
442 |
"| Does not match any current feedback mode: mymode"), |
|
443 |
(a) -> assertCommandCheckOutput(a, "/set feedback", |
|
444 |
(s) -> assertFalse(s.contains("mymode"), "Didn't delete mymode: " + s)), |
|
445 |
(a) -> assertCommandCheckOutput(a, "/set feedback", |
|
446 |
(s) -> assertFalse(s.contains("kmode"), "Didn't delete kmode: " + s)), |
|
447 |
(a) -> assertCommandCheckOutput(a, "/set feedback", |
|
448 |
(s) -> assertFalse(s.contains("tmode"), "Didn't delete tmode: " + s)) |
|
449 |
); |
|
450 |
} |
|
451 |
||
452 |
} |