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
This commit is contained in:
Robert Field 2016-11-16 10:45:23 -08:00
parent da7b11ca15
commit f3e88eb313
3 changed files with 15 additions and 3 deletions

View File

@ -1962,6 +1962,8 @@ public class JShellTool implements MessageHandler {
case ASSIGNMENT_SUBKIND:
case OTHER_EXPRESSION_SUBKIND:
case TEMP_VAR_EXPRESSION_SUBKIND:
case STATEMENT_SUBKIND:
case UNKNOWN_SUBKIND:
if (!src.endsWith(";")) {
src = src + ";";
}

View File

@ -125,7 +125,6 @@ public abstract class EditorTestBase extends ReplToolTesting {
);
}
@Test(enabled = false) // TODO 8163816
public void testEditClass1() {
testEditor(
a -> assertClass(a, "class A {}", "class", "A"),
@ -163,7 +162,6 @@ public abstract class EditorTestBase extends ReplToolTesting {
);
}
@Test(enabled = false) // TODO 8163816
public void testEditMethod1() {
testEditor(
a -> assertMethod(a, "void f() {}", "()void", "f"),
@ -247,6 +245,18 @@ public abstract class EditorTestBase extends ReplToolTesting {
);
}
@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();

View File

@ -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