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