summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@typesafe.com>2016-05-23 15:50:29 +0200
committerLukas Rytz <lukas.rytz@typesafe.com>2016-05-23 15:50:29 +0200
commit8e92ba0eb8c1e651c56493d00bc478ae7a3e9f39 (patch)
treea75c79945455e381f73016fac52c060051e23757 /test/files/run
parent95f57600a7498f269d32743788c89d4d65f93700 (diff)
parent883fdd74d63a54495f4013eef81c9b5ebc850d1c (diff)
downloadscala-8e92ba0eb8c1e651c56493d00bc478ae7a3e9f39.tar.gz
scala-8e92ba0eb8c1e651c56493d00bc478ae7a3e9f39.tar.bz2
scala-8e92ba0eb8c1e651c56493d00bc478ae7a3e9f39.zip
Merge pull request #5153 from petermz/ticket/5463
SI-5463 Check .jars before using them
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/t5463.scala21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/files/run/t5463.scala b/test/files/run/t5463.scala
new file mode 100644
index 0000000000..30b8306156
--- /dev/null
+++ b/test/files/run/t5463.scala
@@ -0,0 +1,21 @@
+import scala.reflect.internal.FatalError
+import scala.tools.partest.DirectTest
+
+object Test extends DirectTest {
+
+ def code = "class A"
+
+ override def show(): Unit = {
+ // Create a broken JAR file and put it on compiler classpath
+ val jarpath = testOutput.path + "/notajar.jar"
+ scala.reflect.io.File(jarpath).writeAll("This isn't really a JAR file")
+
+ val classpath = List(sys.props("partest.lib"), jarpath, testOutput.path) mkString sys.props("path.separator")
+ try {
+ compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code)
+ throw new Error("Compilation should have failed");
+ } catch {
+ case ex: FatalError => // this is expected
+ }
+ }
+}