langtools/test/jdk/jshell/ToolReloadTest.java
changeset 35812 6a6ca0bd3c14
parent 35359 f04501964016
child 36154 63cd939d7e20
equal deleted inserted replaced
35811:3779fa4164c2 35812:6a6ca0bd3c14
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 8081845
    26  * @bug 8081845 8147898
    27  * @summary Tests for /reload in JShell tool
    27  * @summary Tests for /reload in JShell tool
    28  * @modules jdk.compiler/com.sun.tools.javac.api
    28  * @modules jdk.compiler/com.sun.tools.javac.api
    29  *          jdk.compiler/com.sun.tools.javac.main
    29  *          jdk.compiler/com.sun.tools.javac.main
    30  *          jdk.jshell/jdk.internal.jshell.tool
    30  *          jdk.jshell/jdk.internal.jshell.tool
    31  * @library /tools/lib
    31  * @library /tools/lib
   108                 a -> assertCommandCheckOutput(a, "/classes", assertClasses()),
   108                 a -> assertCommandCheckOutput(a, "/classes", assertClasses()),
   109                 a -> assertCommandCheckOutput(a, "/imports", assertImports())
   109                 a -> assertCommandCheckOutput(a, "/imports", assertImports())
   110         );
   110         );
   111     }
   111     }
   112 
   112 
       
   113     public void testReloadQuiet() {
       
   114         test(false, new String[]{"-nostartup"},
       
   115                 a -> assertVariable(a, "int", "a"),
       
   116                 a -> dropVariable(a, "/dr 1", "int a = 0"),
       
   117                 a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
       
   118                 a -> dropMethod(a, "/drop b", "b ()I"),
       
   119                 a -> assertClass(a, "class A {}", "class", "A"),
       
   120                 a -> dropClass(a, "/dr A", "class A"),
       
   121                 a -> assertCommand(a, "/reload quiet",
       
   122                         "|  Restarting and restoring state.\n"),
       
   123                 a -> assertCommandCheckOutput(a, "/vars", assertVariables()),
       
   124                 a -> assertCommandCheckOutput(a, "/methods", assertMethods()),
       
   125                 a -> assertCommandCheckOutput(a, "/classes", assertClasses()),
       
   126                 a -> assertCommandCheckOutput(a, "/imports", assertImports())
       
   127         );
       
   128     }
       
   129 
   113     public void testReloadRepeat() {
   130     public void testReloadRepeat() {
   114         test(false, new String[]{"-nostartup"},
   131         test(false, new String[]{"-nostartup"},
   115                 (a) -> assertVariable(a, "int", "c", "7", "7"),
   132                 (a) -> assertVariable(a, "int", "c", "7", "7"),
   116                 (a) -> assertCommand(a, "++c", null),
   133                 (a) -> assertCommand(a, "++c", null),
   117                 (a) -> assertCommand(a, "/!", null),
   134                 (a) -> assertCommand(a, "/!", null),