summaryrefslogtreecommitdiff
path: root/test/files/run/t5463.scala
blob: 30b8306156d3f7f9c857a683b85633bf6e1e0d65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
    }
  }
}