summaryrefslogtreecommitdiff
path: root/test/files/run/t5463.scala
diff options
context:
space:
mode:
authorpeterz <peterz@rambler.ru>2016-05-10 11:54:21 +0300
committerpetermz <peter.zhelezniakov@gmail.com>2016-05-17 17:22:45 +0300
commit883fdd74d63a54495f4013eef81c9b5ebc850d1c (patch)
tree6c4d97ead6446ce0ebbe980980454ca3614f7523 /test/files/run/t5463.scala
parent3ea78b7583a5b69065b532697372e669e4bbadce (diff)
downloadscala-883fdd74d63a54495f4013eef81c9b5ebc850d1c.tar.gz
scala-883fdd74d63a54495f4013eef81c9b5ebc850d1c.tar.bz2
scala-883fdd74d63a54495f4013eef81c9b5ebc850d1c.zip
SI-5463 Check .jars before using them
Make broken JAR files on compiler classpath cause a fatal error
Diffstat (limited to 'test/files/run/t5463.scala')
-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
+ }
+ }
+}