8210808: jshell tool: only considers the first snippet of the external editor

Reviewed-by: jlahoda, sundar
This commit is contained in:
Robert Field 2018-10-29 08:34:33 -07:00
parent 7a9db013b7
commit 37ef084d73
3 changed files with 20 additions and 2 deletions

View File

@ -2936,7 +2936,7 @@ public class JShellTool implements MessageHandler {
}
String tsrc = trimNewlines(an.source());
if (!failed && !currSrcs.contains(tsrc)) {
failed = processSource(tsrc);
failed = !processSource(tsrc);
}
nextSrcs.add(tsrc);
if (an.remaining().isEmpty()) {

View File

@ -125,6 +125,24 @@ public abstract class EditorTestBase extends ReplToolTesting {
);
}
@Test
public void testWriteVariables() {
testEditor(
a -> assertEditOutput(a, "/edit",
"x ==> 1\n" +
"y ==> 2\n" +
"z ==> 3",
() -> {
writeSource(
"var x = 1;\n" +
"var y = 2;\n" +
"var z = 3;\n");
exit();
}),
a -> assertCommand(a, "z", "z ==> 3")
);
}
public void testEditClass1() {
testEditor(
a -> assertClass(a, "class A {}", "class", "A"),

View File

@ -24,7 +24,7 @@
/*
* @test
* @summary Testing external editor.
* @bug 8143955 8080843 8163816 8143006 8169828 8171130 8162989
* @bug 8143955 8080843 8163816 8143006 8169828 8171130 8162989 8210808
* @modules jdk.jshell/jdk.internal.jshell.tool
* @build ReplToolTesting CustomEditor EditorTestBase
* @run testng ExternalEditorTest