langtools/test/jdk/jshell/ToolBasicTest.java
changeset 36990 ec0b843a7af5
parent 36778 e04318f39f92
child 37007 6023a9a9d58a
equal deleted inserted replaced
36782:6072af7a98be 36990:ec0b843a7af5
    41 import java.nio.file.Path;
    41 import java.nio.file.Path;
    42 import java.nio.file.Paths;
    42 import java.nio.file.Paths;
    43 import java.util.ArrayList;
    43 import java.util.ArrayList;
    44 import java.util.Arrays;
    44 import java.util.Arrays;
    45 import java.util.List;
    45 import java.util.List;
       
    46 import java.util.Locale;
    46 import java.util.Scanner;
    47 import java.util.Scanner;
    47 import java.util.function.BiFunction;
    48 import java.util.function.BiFunction;
    48 import java.util.function.Consumer;
    49 import java.util.function.Consumer;
    49 import java.util.function.Function;
    50 import java.util.function.Function;
    50 import java.util.prefs.BackingStoreException;
    51 import java.util.prefs.BackingStoreException;
   461             );
   462             );
   462             test(new String[]{"-nostartup"},
   463             test(new String[]{"-nostartup"},
   463                     (a) -> assertCommandCheckOutput(a, "printf(\"\")", assertStartsWith("|  Error:\n|  cannot find symbol"))
   464                     (a) -> assertCommandCheckOutput(a, "printf(\"\")", assertStartsWith("|  Error:\n|  cannot find symbol"))
   464             );
   465             );
   465             test((a) -> assertCommand(a, "printf(\"A\")", "", "", null, "A", ""));
   466             test((a) -> assertCommand(a, "printf(\"A\")", "", "", null, "A", ""));
   466             test(false, new String[]{"-startup", "UNKNOWN"}, "|  File 'UNKNOWN' for start-up is not found.");
   467             test(Locale.ROOT, false, new String[]{"-startup", "UNKNOWN"}, "|  File 'UNKNOWN' for start-up is not found.");
   467         } finally {
   468         } finally {
   468             removeStartup();
   469             removeStartup();
   469         }
   470         }
   470     }
   471     }
   471 
   472 
   476         test(new String[] { path.toString() },
   477         test(new String[] { path.toString() },
   477                 (a) -> assertCommand(a, "x", "|  Variable x of type double has value 20.0\n"),
   478                 (a) -> assertCommand(a, "x", "|  Variable x of type double has value 20.0\n"),
   478                 (a) -> assertCommand(a, "a", "|  Variable a of type double has value 10.0\n")
   479                 (a) -> assertCommand(a, "a", "|  Variable a of type double has value 10.0\n")
   479         );
   480         );
   480         Path unknown = compiler.getPath("UNKNOWN.jar");
   481         Path unknown = compiler.getPath("UNKNOWN.jar");
   481         test(true, new String[]{unknown.toString()},
   482         test(Locale.ROOT, true, new String[]{unknown.toString()},
   482                 "|  File '" + unknown
   483                 "|  File " + unknown
   483                 + "' is not found: " + unresolvableMessage(unknown) + "\n");
   484                 + " is not found: " + unresolvableMessage(unknown) + "\n");
   484     }
   485     }
   485 
   486 
   486     public void testReset() {
   487     public void testReset() {
   487         test(
   488         test(
   488                 (a) -> assertReset(a, "/r"),
   489                 (a) -> assertReset(a, "/r"),