< prev index next >

test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java

Print this page




  41 import toolbox.*;
  42 
  43 public class ReleaseOptions extends ModuleTestBase {
  44 
  45     public static void main(String... args) throws Exception {
  46         new ReleaseOptions().runTests();
  47     }
  48 
  49     @Test
  50     public void testReleaseWithPatchModule(Path base) throws Exception {
  51         Path src = Paths.get(base.toString(), "src");
  52         Path mpath = Paths.get(src. toString(), "m");
  53 
  54         tb.writeJavaFiles(mpath,
  55                 "module m { exports p; }",
  56                 "package p; public class C { }");
  57 
  58         Task.Result result = execNegativeTask("--release", "8",
  59                 "--patch-module", "m=" + mpath.toString(),
  60                 "p");
  61         assertMessagePresent(".*not allowed with target 1.8.*");
  62         assertMessageNotPresent(".*Exception*");
  63         assertMessageNotPresent(".java.lang.AssertionError.*");
  64     }
  65 
  66     @Test
  67     public void testReleaseWithSourcepath(Path base) throws Exception {
  68         Path src = Paths.get(base.toString(), "src");
  69         Path mpath = Paths.get(src. toString(), "m");
  70 
  71         tb.writeJavaFiles(mpath,
  72                 "module m { exports p; }",
  73                 "package p; public class C { }");
  74 
  75         Task.Result result = execNegativeTask("--release", "8",
  76                 "--source-path", mpath.toString(),
  77                 "--module", "m");
  78         assertMessagePresent(".*(use -source 9 or higher to enable modules).*");
  79         assertMessageNotPresent(".*Exception*");
  80         assertMessageNotPresent(".java.lang.AssertionError.*");
  81     }
  82 
  83     @Test
  84     public void testReleaseWithModuleSourcepath(Path base) throws Exception {
  85         Path src = Paths.get(base.toString(), "src");
  86         Path mpath = Paths.get(src.toString(), "m");
  87 
  88         tb.writeJavaFiles(mpath,
  89                 "module m { exports p; }",
  90                 "package p; public class C { }");
  91 
  92         Task.Result result = execNegativeTask("--release", "8",
  93                 "--module-source-path", src.toString(),
  94                 "--module", "m");
  95         assertMessagePresent(".*not allowed with target 1.8.*");
  96         assertMessageNotPresent(".*Exception*");
  97         assertMessageNotPresent(".java.lang.AssertionError.*");
  98     }
  99 }


  41 import toolbox.*;
  42 
  43 public class ReleaseOptions extends ModuleTestBase {
  44 
  45     public static void main(String... args) throws Exception {
  46         new ReleaseOptions().runTests();
  47     }
  48 
  49     @Test
  50     public void testReleaseWithPatchModule(Path base) throws Exception {
  51         Path src = Paths.get(base.toString(), "src");
  52         Path mpath = Paths.get(src. toString(), "m");
  53 
  54         tb.writeJavaFiles(mpath,
  55                 "module m { exports p; }",
  56                 "package p; public class C { }");
  57 
  58         Task.Result result = execNegativeTask("--release", "8",
  59                 "--patch-module", "m=" + mpath.toString(),
  60                 "p");
  61         assertMessagePresent(".*not allowed with target 8.*");
  62         assertMessageNotPresent(".*Exception*");
  63         assertMessageNotPresent(".java.lang.AssertionError.*");
  64     }
  65 
  66     @Test
  67     public void testReleaseWithSourcepath(Path base) throws Exception {
  68         Path src = Paths.get(base.toString(), "src");
  69         Path mpath = Paths.get(src. toString(), "m");
  70 
  71         tb.writeJavaFiles(mpath,
  72                 "module m { exports p; }",
  73                 "package p; public class C { }");
  74 
  75         Task.Result result = execNegativeTask("--release", "8",
  76                 "--source-path", mpath.toString(),
  77                 "--module", "m");
  78         assertMessagePresent(".*(use -source 9 or higher to enable modules).*");
  79         assertMessageNotPresent(".*Exception*");
  80         assertMessageNotPresent(".java.lang.AssertionError.*");
  81     }
  82 
  83     @Test
  84     public void testReleaseWithModuleSourcepath(Path base) throws Exception {
  85         Path src = Paths.get(base.toString(), "src");
  86         Path mpath = Paths.get(src.toString(), "m");
  87 
  88         tb.writeJavaFiles(mpath,
  89                 "module m { exports p; }",
  90                 "package p; public class C { }");
  91 
  92         Task.Result result = execNegativeTask("--release", "8",
  93                 "--module-source-path", src.toString(),
  94                 "--module", "m");
  95         assertMessagePresent(".*not allowed with target 8.*");
  96         assertMessageNotPresent(".*Exception*");
  97         assertMessageNotPresent(".java.lang.AssertionError.*");
  98     }
  99 }
< prev index next >