test/jdk/jshell/ToolReloadTest.java

Print this page

        

*** 88,98 **** (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "Aprime") ); } public void testReloadDrop() { ! test(false, new String[]{"-nostartup"}, a -> assertVariable(a, "int", "a"), a -> dropVariable(a, "/dr 1", "int a = 0", "| dropped variable a"), a -> assertMethod(a, "int b() { return 0; }", "()I", "b"), a -> dropMethod(a, "/drop b", "b ()I", "| dropped method b()"), a -> assertClass(a, "class A {}", "class", "A"), --- 88,98 ---- (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "Aprime") ); } public void testReloadDrop() { ! test(false, new String[]{"--no-startup"}, a -> assertVariable(a, "int", "a"), a -> dropVariable(a, "/dr 1", "int a = 0", "| dropped variable a"), a -> assertMethod(a, "int b() { return 0; }", "()I", "b"), a -> dropMethod(a, "/drop b", "b ()I", "| dropped method b()"), a -> assertClass(a, "class A {}", "class", "A"),
*** 111,121 **** a -> assertCommandCheckOutput(a, "/imports", assertImports()) ); } public void testReloadQuiet() { ! test(false, new String[]{"-nostartup"}, a -> assertVariable(a, "int", "a"), a -> dropVariable(a, "/dr 1", "int a = 0", "| dropped variable a"), a -> assertMethod(a, "int b() { return 0; }", "()I", "b"), a -> dropMethod(a, "/drop b", "b ()I", "| dropped method b()"), a -> assertClass(a, "class A {}", "class", "A"), --- 111,121 ---- a -> assertCommandCheckOutput(a, "/imports", assertImports()) ); } public void testReloadQuiet() { ! test(false, new String[]{"--no-startup"}, a -> assertVariable(a, "int", "a"), a -> dropVariable(a, "/dr 1", "int a = 0", "| dropped variable a"), a -> assertMethod(a, "int b() { return 0; }", "()I", "b"), a -> dropMethod(a, "/drop b", "b ()I", "| dropped method b()"), a -> assertClass(a, "class A {}", "class", "A"),
*** 128,138 **** a -> assertCommandCheckOutput(a, "/imports", assertImports()) ); } public void testReloadRepeat() { ! test(false, new String[]{"-nostartup"}, (a) -> assertVariable(a, "int", "c", "7", "7"), (a) -> assertCommand(a, "++c", null), (a) -> assertCommand(a, "/!", null), (a) -> assertCommand(a, "/2", null), (a) -> assertCommand(a, "/-1", null), --- 128,138 ---- a -> assertCommandCheckOutput(a, "/imports", assertImports()) ); } public void testReloadRepeat() { ! test(false, new String[]{"--no-startup"}, (a) -> assertVariable(a, "int", "c", "7", "7"), (a) -> assertCommand(a, "++c", null), (a) -> assertCommand(a, "/!", null), (a) -> assertCommand(a, "/2", null), (a) -> assertCommand(a, "/-1", null),
*** 148,158 **** (a) -> assertCommand(a, "$4", "$4 ==> 10") ); } public void testReloadIgnore() { ! test(false, new String[]{"-nostartup"}, (a) -> assertCommand(a, "(-)", null), (a) -> assertCommand(a, "/list", null), (a) -> assertCommand(a, "/history", null), (a) -> assertCommand(a, "/help", null), (a) -> assertCommand(a, "/vars", null), --- 148,158 ---- (a) -> assertCommand(a, "$4", "$4 ==> 10") ); } public void testReloadIgnore() { ! test(false, new String[]{"--no-startup"}, (a) -> assertCommand(a, "(-)", null), (a) -> assertCommand(a, "/list", null), (a) -> assertCommand(a, "/history", null), (a) -> assertCommand(a, "/help", null), (a) -> assertCommand(a, "/vars", null),
*** 199,215 **** (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()) ); } public void testReloadExitRestore() { ! test(false, new String[]{"-nostartup"}, (a) -> assertVariable(a, "int", "x", "5", "5"), (a) -> assertMethod(a, "int m(int z) { return z * z; }", "(int)int", "m"), (a) -> evaluateExpression(a, "int", "m(x)", "25") ); ! test(false, new String[]{"-nostartup"}, (a) -> assertCommand(a, "/reload -restore", "| Restarting and restoring from previous state.\n" + "-: int x = 5;\n" + "-: int m(int z) { return z * z; }\n" + "-: m(x)\n"), --- 199,215 ---- (a) -> assertCommandCheckOutput(a, "/methods", assertMethods()) ); } public void testReloadExitRestore() { ! test(false, new String[]{"--no-startup"}, (a) -> assertVariable(a, "int", "x", "5", "5"), (a) -> assertMethod(a, "int m(int z) { return z * z; }", "(int)int", "m"), (a) -> evaluateExpression(a, "int", "m(x)", "25") ); ! test(false, new String[]{"--no-startup"}, (a) -> assertCommand(a, "/reload -restore", "| Restarting and restoring from previous state.\n" + "-: int x = 5;\n" + "-: int m(int z) { return z * z; }\n" + "-: m(x)\n"),