author | jjg |
Thu, 31 Mar 2016 15:20:50 -0700 | |
changeset 36778 | e04318f39f92 |
parent 36718 | bf40906bf49d |
child 36990 | ec0b843a7af5 |
permissions | -rw-r--r-- |
36494 | 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 |
|
36718
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
26 |
* @bug 8148316 8148317 8151755 8152246 |
36494 | 27 |
* @summary Tests for output customization |
28 |
* @library /tools/lib |
|
36526 | 29 |
* @modules jdk.compiler/com.sun.tools.javac.api |
30 |
* jdk.compiler/com.sun.tools.javac.main |
|
31 |
* jdk.jdeps/com.sun.tools.javap |
|
32 |
* jdk.jshell/jdk.internal.jshell.tool |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36718
diff
changeset
|
33 |
* @build KullaTesting TestingInputStream toolbox.ToolBox Compiler |
36494 | 34 |
* @run testng ToolFormatTest |
35 |
*/ |
|
36718
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
36 |
import java.util.ArrayList; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
37 |
import java.util.List; |
36494 | 38 |
import org.testng.annotations.Test; |
39 |
||
40 |
@Test |
|
41 |
public class ToolFormatTest extends ReplToolTesting { |
|
42 |
||
43 |
public void testSetFormat() { |
|
44 |
try { |
|
45 |
test( |
|
46 |
(a) -> assertCommandOutputStartsWith(a, "/set newmode test command", "| Created new feedback mode: test"), |
|
36718
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
47 |
(a) -> assertCommand(a, "/set format test pre '$ '", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
48 |
(a) -> assertCommand(a, "/set format test post ''", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
49 |
(a) -> assertCommand(a, "/set format test act 'ADD' added", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
50 |
(a) -> assertCommand(a, "/set format test act 'MOD' modified", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
51 |
(a) -> assertCommand(a, "/set format test act 'REP' replaced", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
52 |
(a) -> assertCommand(a, "/set format test act 'OVR' overwrote", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
53 |
(a) -> assertCommand(a, "/set format test act 'USE' used", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
54 |
(a) -> assertCommand(a, "/set format test act 'DRP' dropped", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
55 |
(a) -> assertCommand(a, "/set format test up 'UP-' update", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
56 |
(a) -> assertCommand(a, "/set format test action '{up}{act} '", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
57 |
(a) -> assertCommand(a, "/set format test resolve 'OK' ok", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
58 |
(a) -> assertCommand(a, "/set format test resolve 'DEF' defined", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
59 |
(a) -> assertCommand(a, "/set format test resolve 'NODEF' notdefined", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
60 |
(a) -> assertCommand(a, "/set format test fname ':{name} ' ", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
61 |
(a) -> assertCommand(a, "/set format test ftype '[{type}]' method,expression", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
62 |
(a) -> assertCommand(a, "/set format test result '={value} ' expression", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
63 |
(a) -> assertCommand(a, "/set format test display '{pre}{action}{ftype}{fname}{result}{resolve}'", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
64 |
(a) -> assertCommand(a, "/set format test display '{pre}HI this is enum' enum", ""), |
36494 | 65 |
(a) -> assertCommand(a, "/set feedback test", "$ Feedback mode: test"), |
66 |
(a) -> assertCommand(a, "class D {}", "$ ADD :D OK"), |
|
67 |
(a) -> assertCommand(a, "void m() {}", "$ ADD []:m OK"), |
|
68 |
(a) -> assertCommand(a, "interface EX extends EEX {}", "$ ADD :EX NODEF"), |
|
69 |
(a) -> assertCommand(a, "56", "$ ADD [int]:$4 =56 OK"), |
|
36718
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
70 |
(a) -> assertCommand(a, "class D { int hh; }", "$ REP :D OK$ UP-OVR :D OK"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
71 |
(a) -> assertCommand(a, "enum E {A,B}", "$ HI this is enum"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
72 |
(a) -> assertCommand(a, "int z() { return f(); }", "$ ADD []:z DEF"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
73 |
(a) -> assertCommand(a, "z()", "$ UP-USE []:z DEF"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
74 |
(a) -> assertCommand(a, "/drop z", "$ DRP []:z OK"), |
36494 | 75 |
(a) -> assertCommandOutputStartsWith(a, "/set feedback normal", "| Feedback mode: normal") |
76 |
); |
|
77 |
} finally { |
|
78 |
assertCommandCheckOutput(false, "/set feedback normal", s -> { |
|
79 |
}); |
|
80 |
} |
|
81 |
} |
|
82 |
||
36718
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
83 |
public void testSetFormatSelector() { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
84 |
List<ReplTest> tests = new ArrayList<>(); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
85 |
tests.add((a) -> assertCommandOutputStartsWith(a, "/set newmode ate quiet", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
86 |
"| Created new feedback mode: ate")); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
87 |
tests.add((a) -> assertCommand(a, "/set feedback ate", "")); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
88 |
StringBuilder sb = new StringBuilder(); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
89 |
class KindList { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
90 |
final String[] values; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
91 |
final int matchIndex; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
92 |
int current; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
93 |
boolean match; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
94 |
KindList(String[] values, int matchIndex) { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
95 |
this.values = values; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
96 |
this.matchIndex = matchIndex; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
97 |
this.current = 1 << values.length; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
98 |
} |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
99 |
boolean next() { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
100 |
if (current <= 0) { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
101 |
return false; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
102 |
} |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
103 |
--current; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
104 |
return true; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
105 |
} |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
106 |
boolean append(boolean ahead) { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
107 |
boolean any = false; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
108 |
match = false; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
109 |
for (int i = values.length - 1; i >= 0 ; --i) { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
110 |
if ((current & (1 << i)) != 0) { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
111 |
match |= i == matchIndex; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
112 |
if (any) { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
113 |
sb.append(","); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
114 |
} else { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
115 |
if (ahead) { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
116 |
sb.append("-"); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
117 |
} |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
118 |
} |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
119 |
sb.append(values[i]); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
120 |
any = true; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
121 |
} |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
122 |
} |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
123 |
match |= !any; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
124 |
return ahead || any; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
125 |
} |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
126 |
} |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
127 |
KindList klcase = new KindList(new String[] {"class", "method", "expression", "vardecl"}, 2); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
128 |
while (klcase.next()) { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
129 |
KindList klact = new KindList(new String[] {"added", "modified", "replaced"}, 0); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
130 |
while (klact.next()) { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
131 |
KindList klwhen = new KindList(new String[] {"update", "primary"}, 1); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
132 |
while (klwhen.next()) { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
133 |
sb.setLength(0); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
134 |
klwhen.append( |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
135 |
klact.append( |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
136 |
klcase.append(false))); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
137 |
boolean match = klcase.match && klact.match && klwhen.match; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
138 |
String select = sb.toString(); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
139 |
String yes = "+++" + select + "+++"; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
140 |
String no = "---" + select + "---"; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
141 |
String expect = match? yes : no; |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
142 |
tests.add((a) -> assertCommand(a, "/set format ate display '" + no + "'", "")); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
143 |
tests.add((a) -> assertCommand(a, "/set format ate display '" + yes + "' " + select, "")); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
144 |
tests.add((a) -> assertCommand(a, "\"" + select + "\"", expect)); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
145 |
} |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
146 |
} |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
147 |
} |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
148 |
tests.add((a) -> assertCommandOutputStartsWith(a, "/set feedback normal", "| Feedback mode: normal")); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
149 |
|
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
150 |
try { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
151 |
test(tests.toArray(new ReplTest[tests.size()])); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
152 |
} finally { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
153 |
assertCommandCheckOutput(false, "/set feedback normal", s -> { |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
154 |
}); |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
155 |
} |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
156 |
} |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
157 |
|
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
158 |
public void testSetNewModeQuiet() { |
36494 | 159 |
try { |
160 |
test( |
|
161 |
(a) -> assertCommandOutputStartsWith(a, "/set newmode nmq quiet normal", "| Created new feedback mode: nmq"), |
|
162 |
(a) -> assertCommand(a, "/set feedback nmq", ""), |
|
163 |
(a) -> assertCommand(a, "/se ne nmq2 q nor", ""), |
|
164 |
(a) -> assertCommand(a, "/se fee nmq2", ""), |
|
165 |
(a) -> assertCommand(a, "/set newmode nmc command normal", ""), |
|
166 |
(a) -> assertCommandOutputStartsWith(a, "/set feedback nmc", "| Feedback mode: nmc"), |
|
167 |
(a) -> assertCommandOutputStartsWith(a, "/set newmode nm", "| Created new feedback mode: nm"), |
|
36718
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
168 |
(a) -> assertCommandOutputStartsWith(a, "/set feedback nm", "| Feedback mode: nm"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
169 |
(a) -> assertCommandOutputStartsWith(a, "/set feedback normal", "| Feedback mode: normal") |
36494 | 170 |
); |
171 |
} finally { |
|
172 |
assertCommandCheckOutput(false, "/set feedback normal", s -> { |
|
173 |
}); |
|
174 |
} |
|
175 |
} |
|
176 |
||
177 |
public void testSetError() { |
|
178 |
try { |
|
179 |
test( |
|
36718
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
180 |
(a) -> assertCommandOutputStartsWith(a, "/set newmode tee command foo", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
181 |
"| Does not match any current feedback mode: foo"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
182 |
(a) -> assertCommandOutputStartsWith(a, "/set newmode tee flurb", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
183 |
"| Specify either 'command' or 'quiet'"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
184 |
(a) -> assertCommandOutputStartsWith(a, "/set newmode te2", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
185 |
"| Created new feedback mode: te2"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
186 |
(a) -> assertCommandOutputStartsWith(a, "/set newmode te2 command", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
187 |
"| Expected a new feedback mode name. te2 is a known feedback mode"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
188 |
(a) -> assertCommandOutputStartsWith(a, "/set newmode te command normal", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
189 |
"| Created new feedback mode: te"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
190 |
(a) -> assertCommand(a, "/set format te errorpre 'ERROR: '", ""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
191 |
(a) -> assertCommandOutputStartsWith(a, "/set feedback te", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
192 |
""), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
193 |
(a) -> assertCommandOutputStartsWith(a, "/set ", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
194 |
"ERROR: The /set command requires arguments"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
195 |
(a) -> assertCommandOutputStartsWith(a, "/set xyz", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
196 |
"ERROR: Not a valid argument to /set"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
197 |
(a) -> assertCommandOutputStartsWith(a, "/set f", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
198 |
"ERROR: Ambiguous argument to /set"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
199 |
(a) -> assertCommandOutputStartsWith(a, "/set feedback", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
200 |
"ERROR: Expected a feedback mode"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
201 |
(a) -> assertCommandOutputStartsWith(a, "/set feedback xyz", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
202 |
"ERROR: Does not match any current feedback mode"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
203 |
(a) -> assertCommandOutputStartsWith(a, "/set format", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
204 |
"ERROR: Expected a feedback mode"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
205 |
(a) -> assertCommandOutputStartsWith(a, "/set format xyz", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
206 |
"ERROR: Does not match any current feedback mode"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
207 |
(a) -> assertCommandOutputStartsWith(a, "/set format t", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
208 |
"ERROR: Matches more then one current feedback mode: t"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
209 |
(a) -> assertCommandOutputStartsWith(a, "/set format te", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
210 |
"ERROR: Expected field name missing"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
211 |
(a) -> assertCommandOutputStartsWith(a, "/set format te fld", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
212 |
"ERROR: Expected format missing"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
213 |
(a) -> assertCommandOutputStartsWith(a, "/set format te fld aaa", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
214 |
"ERROR: Format 'aaa' must be quoted"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
215 |
(a) -> assertCommandOutputStartsWith(a, "/set format te fld 'aaa' frog", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
216 |
"ERROR: Not a valid selector"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
217 |
(a) -> assertCommandOutputStartsWith(a, "/set format te fld 'aaa' import-frog", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
218 |
"ERROR: Not a valid selector"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
219 |
(a) -> assertCommandOutputStartsWith(a, "/set format te fld 'aaa' import-import", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
220 |
"ERROR: Selector kind in multiple sections of"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
221 |
(a) -> assertCommandOutputStartsWith(a, "/set format te fld 'aaa' import,added", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
222 |
"ERROR: Different selector kinds in same sections of"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
223 |
(a) -> assertCommandOutputStartsWith(a, "/set newmode", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
224 |
"ERROR: Expected new feedback mode"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
225 |
(a) -> assertCommandOutputStartsWith(a, "/set newmode te", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
226 |
"ERROR: Expected a new feedback mode name"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
227 |
(a) -> assertCommandOutputStartsWith(a, "/set newmode x xyz", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
228 |
"ERROR: Specify either 'command' or 'quiet'"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
229 |
(a) -> assertCommandOutputStartsWith(a, "/set newmode x quiet y", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
230 |
"ERROR: Does not match any current feedback mode"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
231 |
(a) -> assertCommandOutputStartsWith(a, "/set prompt", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
232 |
"ERROR: Expected a feedback mode"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
233 |
(a) -> assertCommandOutputStartsWith(a, "/set prompt te", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
234 |
"ERROR: Expected format missing"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
235 |
(a) -> assertCommandOutputStartsWith(a, "/set prompt te aaa xyz", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
236 |
"ERROR: Format 'aaa' must be quoted"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
237 |
(a) -> assertCommandOutputStartsWith(a, "/set prompt te 'aaa' xyz", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
238 |
"ERROR: Format 'xyz' must be quoted"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
239 |
(a) -> assertCommandOutputStartsWith(a, "/set prompt", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
240 |
"ERROR: Expected a feedback mode"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
241 |
(a) -> assertCommandOutputStartsWith(a, "/set prompt te", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
242 |
"ERROR: Expected format missing"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
243 |
(a) -> assertCommandOutputStartsWith(a, "/set prompt te aaa", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
244 |
"ERROR: Format 'aaa' must be quoted"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
245 |
(a) -> assertCommandOutputStartsWith(a, "/set prompt te 'aaa'", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
246 |
"ERROR: Expected format missing"), |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
247 |
(a) -> assertCommandOutputStartsWith(a, "/set feedback normal", |
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
248 |
"| Feedback mode: normal") |
36494 | 249 |
); |
250 |
} finally { |
|
251 |
assertCommandCheckOutput(false, "/set feedback normal", s -> { |
|
252 |
}); |
|
253 |
} |
|
254 |
} |
|
255 |
||
256 |
public void testSetHelp() { |
|
257 |
try { |
|
258 |
test( |
|
259 |
(a) -> assertCommandOutputContains(a, "/help /set", "command to launch"), |
|
36718
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
260 |
(a) -> assertCommandOutputContains(a, "/help /set format", "display"), |
36494 | 261 |
(a) -> assertCommandOutputContains(a, "/hel /se for", "vardecl"), |
262 |
(a) -> assertCommandOutputContains(a, "/help /set editor", "temporary file") |
|
263 |
); |
|
264 |
} finally { |
|
265 |
assertCommandCheckOutput(false, "/set feedback normal", s -> { |
|
266 |
}); |
|
267 |
} |
|
268 |
} |
|
269 |
||
270 |
public void testSetHelpError() { |
|
271 |
try { |
|
272 |
test( |
|
273 |
(a) -> assertCommandOutputStartsWith(a, "/set newmode te command normal", "| Created new feedback mode: te"), |
|
36718
bf40906bf49d
8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents:
36526
diff
changeset
|
274 |
(a) -> assertCommand(a, "/set format te errorpre 'ERROR: '", ""), |
36494 | 275 |
(a) -> assertCommandOutputStartsWith(a, "/set feedback te", "| Feedback mode: te"), |
276 |
(a) -> assertCommandOutputContains(a, "/help /set xyz", "ERROR: Not a valid argument to /set: xyz"), |
|
277 |
(a) -> assertCommandOutputContains(a, "/help /set f", "ERROR: Ambiguous argument to /set: f") |
|
278 |
); |
|
279 |
} finally { |
|
280 |
assertCommandCheckOutput(false, "/set feedback normal", s -> { |
|
281 |
}); |
|
282 |
} |
|
283 |
} |
|
284 |
} |