Skip to content

Commit

Permalink
Fixing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lahodaj committed Jan 20, 2025
1 parent a39f6bc commit 881bef1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
import module java.base;
import static java.io.IO.*;
16 changes: 8 additions & 8 deletions test/langtools/jdk/jshell/ConsoleToolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,31 @@ public void testOutput() {
public void testIO() {
test(new String[] {"--enable-preview"},
a -> {assertCommandWithOutputAndTerminal(a,
"java.io.IO.readln(\"%%s\");\ninput", //newline automatically appended
"java.lang.IO.readln(\"%%s\");\ninput", //newline automatically appended
"$1 ==> \"input\"",
"""
\u0005java.io.IO.readln(\"%%s\");
\u0005java.lang.IO.readln(\"%%s\");
%%sinput
""");},
a -> {assertCommandWithOutputAndTerminal(a,
"java.io.IO.readln();\ninput!", //newline automatically appended
"java.lang.IO.readln();\ninput!", //newline automatically appended
"$2 ==> \"input!\"",
"""
\u0005java.io.IO.readln();
\u0005java.lang.IO.readln();
input!
""");},
a -> {assertCommandWithOutputAndTerminal(a,
"java.io.IO.println(\"Hello, World!\");",
"java.lang.IO.println(\"Hello, World!\");",
"",
"""
\u0005java.io.IO.println(\"Hello, World!\");
\u0005java.lang.IO.println(\"Hello, World!\");
Hello, World!
""");},
a -> {assertCommandWithOutputAndTerminal(a,
"java.io.IO.println();",
"java.lang.IO.println();",
"",
"""
\u0005java.io.IO.println();
\u0005java.lang.IO.println();
""");}
);
Expand Down
43 changes: 0 additions & 43 deletions test/langtools/tools/javac/ImplicitClass/ImplicitImports.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,49 +131,6 @@ public static void main(String... args) {
}
}

@Test
public void testImplicitSimpleIOImport(Path base) throws Exception {
Path current = base.resolve(".");

Path patchClasses = prepareIOPatch(current);

Path src = current.resolve("src");
Path classes = current.resolve("classes");
tb.writeFile(src.resolve("Test.java"),
"""
public static void main(String... args) {
println("Hello, World!");
}
""");

Files.createDirectories(classes);

new JavacTask(tb)
.options("--enable-preview", "--release", SOURCE_VERSION,
"--patch-module", "java.base=" + patchClasses)
.outdir(classes)
.files(tb.findJavaFiles(src))
.run(Task.Expect.SUCCESS)
.writeAll();

var out = new JavaTask(tb)
.classpath(classes.toString())
.className("Test")
.vmOptions("--enable-preview",
"--patch-module", "java.base=" + patchClasses)
.run()
.writeAll()
.getOutputLines(Task.OutputKind.STDOUT);

var expectedOut = List.of("Hello, World!");

if (!Objects.equals(expectedOut, out)) {
throw new AssertionError("Incorrect Output, expected: " + expectedOut +
", actual: " + out);

}
}

@Test
public void testNoImplicitImportsForOrdinaryClasses(Path base) throws Exception {
Path current = base.resolve(".");
Expand Down
1 change: 1 addition & 0 deletions test/langtools/tools/javac/diags/examples.not-yet.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ compiler.warn.illegal.char.for.encoding
compiler.warn.incubating.modules # requires adjusted classfile
compiler.warn.invalid.archive.file
compiler.warn.invalid.utf8.in.classfile # bad class file
compiler.warn.is.preview # difficult to produce reliably despite future changes to java.base
compiler.warn.is.preview.reflective # difficult to produce reliably despite future changes to java.base
compiler.warn.output.file.clash # this warning is not generated on Linux
compiler.warn.override.bridge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

// key: compiler.misc.feature.implicit.classes
// key: compiler.warn.preview.feature.use.plural
// key: compiler.warn.is.preview
// options: -source ${jdk.version} --enable-preview -Xlint:preview

public static void main(String... args) {
Expand Down

0 comments on commit 881bef1

Please sign in to comment.