8143006: jshell tool: /edit doesn't process each line as same as inputs for jshell
8163816: JShell tests: jdk/jshell/ExternalEditorTest.java -- unexpected results EditorTestBase.testEditClass1() and .testEditMethod1()
Reviewed-by: jlahoda
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Wed Nov 16 17:48:43 2016 +0100
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Wed Nov 16 10:45:23 2016 -0800
@@ -1962,6 +1962,8 @@
case ASSIGNMENT_SUBKIND:
case OTHER_EXPRESSION_SUBKIND:
case TEMP_VAR_EXPRESSION_SUBKIND:
+ case STATEMENT_SUBKIND:
+ case UNKNOWN_SUBKIND:
if (!src.endsWith(";")) {
src = src + ";";
}
--- a/langtools/test/jdk/jshell/EditorTestBase.java Wed Nov 16 17:48:43 2016 +0100
+++ b/langtools/test/jdk/jshell/EditorTestBase.java Wed Nov 16 10:45:23 2016 -0800
@@ -125,7 +125,6 @@
);
}
- @Test(enabled = false) // TODO 8163816
public void testEditClass1() {
testEditor(
a -> assertClass(a, "class A {}", "class", "A"),
@@ -163,7 +162,6 @@
);
}
- @Test(enabled = false) // TODO 8163816
public void testEditMethod1() {
testEditor(
a -> assertMethod(a, "void f() {}", "()void", "f"),
@@ -247,6 +245,18 @@
);
}
+ @Test
+ public void testStatementMush() {
+ testEditor(
+ a -> assertCommand(a, "System.out.println(\"Hello\")",
+ "", "", null, "Hello\n", ""),
+ a -> assertEditOutput(a, "/ed", "b ==> 10", () -> {
+ writeSource(getSource() + "\nint b = 10");
+ exit();
+ })
+ );
+ }
+
public static ExecutorService getExecutor() {
if (executor == null) {
executor = Executors.newSingleThreadExecutor();
--- a/langtools/test/jdk/jshell/ExternalEditorTest.java Wed Nov 16 17:48:43 2016 +0100
+++ b/langtools/test/jdk/jshell/ExternalEditorTest.java Wed Nov 16 10:45:23 2016 -0800
@@ -24,7 +24,7 @@
/*
* @test
* @summary Testing external editor.
- * @bug 8143955 8080843
+ * @bug 8143955 8080843 8163816 8143006
* @modules jdk.jshell/jdk.internal.jshell.tool
* @build ReplToolTesting CustomEditor EditorTestBase
* @run testng ExternalEditorTest