--- a/langtools/test/jdk/jshell/ToolSimpleTest.java Mon Aug 22 16:32:40 2016 -0700
+++ b/langtools/test/jdk/jshell/ToolSimpleTest.java Mon Aug 22 19:31:37 2016 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024
+ * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089
* @summary Simple jshell tool tests
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.main
@@ -209,7 +209,7 @@
}
public void testDrop() {
- test(false, new String[]{"-nostartup"},
+ test(false, new String[]{"--no-startup"},
a -> assertVariable(a, "int", "a"),
a -> dropVariable(a, "/drop 1", "int a = 0", "| dropped variable a"),
a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
@@ -223,7 +223,7 @@
a -> assertCommandCheckOutput(a, "/types", assertClasses()),
a -> assertCommandCheckOutput(a, "/imports", assertImports())
);
- test(false, new String[]{"-nostartup"},
+ test(false, new String[]{"--no-startup"},
a -> assertVariable(a, "int", "a"),
a -> dropVariable(a, "/drop a", "int a = 0", "| dropped variable a"),
a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
@@ -238,7 +238,7 @@
}
public void testDropNegative() {
- test(false, new String[]{"-nostartup"},
+ test(false, new String[]{"--no-startup"},
a -> assertCommandOutputStartsWith(a, "/drop 0", "| No such snippet: 0"),
a -> assertCommandOutputStartsWith(a, "/drop a", "| No such snippet: a"),
a -> assertCommandCheckOutput(a, "/drop",
@@ -462,20 +462,20 @@
}
public void testOptionQ() {
- test(new String[]{"-q", "-nostartup"},
+ test(new String[]{"-q", "--no-startup"},
(a) -> assertCommand(a, "1+1", "$1 ==> 2"),
(a) -> assertCommand(a, "int x = 5", "")
);
}
- public void testOptionQq() {
- test(new String[]{"-qq", "-nostartup"},
+ public void testOptionS() {
+ test(new String[]{"-s", "--no-startup"},
(a) -> assertCommand(a, "1+1", "")
);
}
public void testOptionV() {
- test(new String[]{"-v", "-nostartup"},
+ test(new String[]{"-v", "--no-startup"},
(a) -> assertCommand(a, "1+1",
"$1 ==> 2\n" +
"| created scratch variable $1 : int")
@@ -483,14 +483,36 @@
}
public void testOptionFeedback() {
- test(new String[]{"-feedback", "concise", "-nostartup"},
+ test(new String[]{"--feedback", "concise", "--no-startup"},
(a) -> assertCommand(a, "1+1", "$1 ==> 2"),
(a) -> assertCommand(a, "int x = 5", "")
);
}
+ public void testCompoundOptions() {
+ Consumer<String> confirmNoStartup = s -> {
+ assertEquals(0, Stream.of(s.split("\n"))
+ .filter(l -> !l.isEmpty())
+ .count(), "Expected no lines: " + s);
+ };
+ test(new String[]{"-nq"},
+ (a) -> assertCommandCheckOutput(a, "/list -all", confirmNoStartup),
+ (a) -> assertCommand(a, "1+1", "$1 ==> 2"),
+ (a) -> assertCommand(a, "int x = 5", "")
+ );
+ test(new String[]{"-qn"},
+ (a) -> assertCommandCheckOutput(a, "/list -all", confirmNoStartup),
+ (a) -> assertCommand(a, "1+1", "$1 ==> 2"),
+ (a) -> assertCommand(a, "int x = 5", "")
+ );
+ test(new String[]{"-ns"},
+ (a) -> assertCommandCheckOutput(a, "/list -all", confirmNoStartup),
+ (a) -> assertCommand(a, "1+1", "")
+ );
+ }
+
public void testOptionR() {
- test(new String[]{"-R-Dthe.sound=blorp", "-nostartup"},
+ test(new String[]{"-R-Dthe.sound=blorp", "--no-startup"},
(a) -> assertCommand(a, "System.getProperty(\"the.sound\")",
"$1 ==> \"blorp\"")
);