langtools/test/jdk/jshell/ToolBasicTest.java
changeset 41852 448273b190ad
parent 41635 cb3d04878117
child 41858 5843b57ce3a6
equal deleted inserted replaced
41643:df0e03e3ca0e 41852:448273b190ad
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 8143037 8142447 8144095 8140265 8144906 8146138 8147887 8147886 8148316 8148317 8143955 8157953 8080347 8154714
    26  * @bug 8143037 8142447 8144095 8140265 8144906 8146138 8147887 8147886 8148316 8148317 8143955 8157953 8080347 8154714 8166649
    27  * @summary Tests for Basic tests for REPL tool
    27  * @summary Tests for Basic tests for REPL 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.jdeps/com.sun.tools.javap
    30  *          jdk.jdeps/com.sun.tools.javap
    31  *          jdk.jshell/jdk.internal.jshell.tool
    31  *          jdk.jshell/jdk.internal.jshell.tool
   287         test(new String[] { "--class-path", jarPath.toString() },
   287         test(new String[] { "--class-path", jarPath.toString() },
   288                 (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
   288                 (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
   289         );
   289         );
   290     }
   290     }
   291 
   291 
       
   292     public void testModulePath() {
       
   293         Compiler compiler = new Compiler();
       
   294         Path modsDir = Paths.get("mods");
       
   295         Path outDir = Paths.get("mods", "org.astro");
       
   296         compiler.compile(outDir, "package org.astro; public class World { public static String name() { return \"world\"; } }");
       
   297         compiler.compile(outDir, "module org.astro { exports org.astro; }");
       
   298         Path modsPath = compiler.getPath(modsDir);
       
   299         test(new String[] { "--module-path", modsPath.toString(), "--add-modules", "org.astro" },
       
   300                 (a) -> assertCommand(a, "import org.astro.World;", ""),
       
   301                 (a) -> evaluateExpression(a, "String",
       
   302                         "String.format(\"Greetings %s!\", World.name());",
       
   303                         "\"Greetings world!\"")
       
   304         );
       
   305     }
       
   306 
   292     public void testStartupFileOption() {
   307     public void testStartupFileOption() {
   293         try {
   308         try {
   294             Compiler compiler = new Compiler();
   309             Compiler compiler = new Compiler();
   295             Path startup = compiler.getPath("StartupFileOption/startup.txt");
   310             Path startup = compiler.getPath("StartupFileOption/startup.txt");
   296             compiler.writeToFile(startup, "class A { public String toString() { return \"A\"; } }");
   311             compiler.writeToFile(startup, "class A { public String toString() { return \"A\"; } }");