diff options
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t6502.scala | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/files/run/t6502.scala b/test/files/run/t6502.scala index 4ce034a482..b0d93ac3fd 100644 --- a/test/files/run/t6502.scala +++ b/test/files/run/t6502.scala @@ -46,6 +46,12 @@ object Test extends StoreReporterDirectTest { } }""" + def app6 = """ + package test6 + class A extends Test { println("created test6.A") } + class Z extends Test { println("created test6.Z") } + trait Test""" + def test1(): Unit = { val jar = "test1.jar" compileCode(app1, jar) @@ -105,11 +111,31 @@ object Test extends StoreReporterDirectTest { println(s"test4 res2: $res2") } + def test5(): Unit = { + val codeToRun = ":require /does/not/exist.jar" + val output = ILoop.run(codeToRun, settings) + assert(!output.contains("NullPointerException"), output) + assert(output.contains("Cannot load '/does/not/exist.jar'"), output) + } + + def test6(): Unit = { + // Avoid java.lang.NoClassDefFoundError triggered by the old appoach of using a Java + // classloader to parse .class files in order to read their names. + val jar = "test6.jar" + compileCode(app6, jar) + val codeToRun = toCodeInSeparateLines(s":require ${testOutput.path}/$jar", "import test6._; new A; new Z") + val output = ILoop.run(codeToRun, settings) + assert(output.contains("created test6.A"), output) + assert(output.contains("created test6.Z"), output) + } + def show(): Unit = { test1() test2() test3() test4() + test5() + test6() } def toCodeInSeparateLines(lines: String*): String = lines.map(_ + "\n").mkString |