equal
deleted
inserted
replaced
47 public static void main(String... args) throws Exception { |
47 public static void main(String... args) throws Exception { |
48 new MultiModuleModeTest().runTests(); |
48 new MultiModuleModeTest().runTests(); |
49 } |
49 } |
50 |
50 |
51 @Test |
51 @Test |
52 void testDuplicateModules(Path base) throws Exception { |
52 public void testDuplicateModules(Path base) throws Exception { |
53 Path src = base.resolve("src"); |
53 Path src = base.resolve("src"); |
54 Path src_m1 = src.resolve("m1"); |
54 Path src_m1 = src.resolve("m1"); |
55 tb.writeJavaFiles(src_m1, "module m1 { }"); |
55 tb.writeJavaFiles(src_m1, "module m1 { }"); |
56 Path src_m2 = src.resolve("m2"); |
56 Path src_m2 = src.resolve("m2"); |
57 tb.writeJavaFiles(src_m2, "module m1 { }"); |
57 tb.writeJavaFiles(src_m2, "module m1 { }"); |
70 if (!log.contains("module-info.java:1:1: compiler.err.duplicate.module: m1")) |
70 if (!log.contains("module-info.java:1:1: compiler.err.duplicate.module: m1")) |
71 throw new Exception("expected output not found"); |
71 throw new Exception("expected output not found"); |
72 } |
72 } |
73 |
73 |
74 @Test |
74 @Test |
75 void testCantFindModule(Path base) throws Exception { |
75 public void testCantFindModule(Path base) throws Exception { |
76 Path src = base.resolve("src"); |
76 Path src = base.resolve("src"); |
77 Path src_m1 = src.resolve("m1"); |
77 Path src_m1 = src.resolve("m1"); |
78 tb.writeJavaFiles(src_m1, "module m1 { }"); |
78 tb.writeJavaFiles(src_m1, "module m1 { }"); |
79 Path misc = base.resolve("misc"); |
79 Path misc = base.resolve("misc"); |
80 tb.writeJavaFiles(misc, "package p; class C { }"); |
80 tb.writeJavaFiles(misc, "package p; class C { }"); |
93 if (!log.contains("C.java:1:1: compiler.err.unnamed.pkg.not.allowed.named.modules")) |
93 if (!log.contains("C.java:1:1: compiler.err.unnamed.pkg.not.allowed.named.modules")) |
94 throw new Exception("expected output not found"); |
94 throw new Exception("expected output not found"); |
95 } |
95 } |
96 |
96 |
97 @Test |
97 @Test |
98 void testModuleNameMismatch(Path base) throws Exception { |
98 public void testModuleNameMismatch(Path base) throws Exception { |
99 Path src = base.resolve("src"); |
99 Path src = base.resolve("src"); |
100 Path src_m1 = src.resolve("m1"); |
100 Path src_m1 = src.resolve("m1"); |
101 tb.writeJavaFiles(src_m1, "module m2 { }"); |
101 tb.writeJavaFiles(src_m1, "module m2 { }"); |
102 Path classes = base.resolve("classes"); |
102 Path classes = base.resolve("classes"); |
103 tb.createDirectories(classes); |
103 tb.createDirectories(classes); |
114 if (!log.contains("module-info.java:1:8: compiler.err.module.name.mismatch: m2, m1")) |
114 if (!log.contains("module-info.java:1:8: compiler.err.module.name.mismatch: m2, m1")) |
115 throw new Exception("expected output not found"); |
115 throw new Exception("expected output not found"); |
116 } |
116 } |
117 |
117 |
118 @Test |
118 @Test |
119 void testImplicitModuleSource(Path base) throws Exception { |
119 public void testImplicitModuleSource(Path base) throws Exception { |
120 Path src = base.resolve("src"); |
120 Path src = base.resolve("src"); |
121 tb.writeJavaFiles(src.resolve("m1"), "module m1 { }"); |
121 tb.writeJavaFiles(src.resolve("m1"), "module m1 { }"); |
122 tb.writeJavaFiles(src.resolve("m2"), "module m2 { requires m1; }"); |
122 tb.writeJavaFiles(src.resolve("m2"), "module m2 { requires m1; }"); |
123 Path modules = base.resolve("modules"); |
123 Path modules = base.resolve("modules"); |
124 Files.createDirectories(modules); |
124 Files.createDirectories(modules); |
130 .run() |
130 .run() |
131 .writeAll(); |
131 .writeAll(); |
132 } |
132 } |
133 |
133 |
134 @Test |
134 @Test |
135 void testImplicitModuleClass(Path base) throws Exception { |
135 public void testImplicitModuleClass(Path base) throws Exception { |
136 Path src1 = base.resolve("src1"); |
136 Path src1 = base.resolve("src1"); |
137 tb.writeJavaFiles(src1.resolve("m1"), "module m1 { }"); |
137 tb.writeJavaFiles(src1.resolve("m1"), "module m1 { }"); |
138 Path modules1 = base.resolve("modules1"); |
138 Path modules1 = base.resolve("modules1"); |
139 Files.createDirectories(modules1); |
139 Files.createDirectories(modules1); |
140 |
140 |