@@ -21,14 +21,15 @@ class VulpixUnitTests extends ParallelTesting {
21
21
def isInteractive = ! sys.env.contains(" DRONE" )
22
22
def testFilter = None
23
23
24
+ // To fail with something else than an AssertionError
25
+ def fail (): Unit = throw new Exception (" didn't fail properly" )
26
+
24
27
@ Test def missingFile : Unit =
25
28
try {
26
29
compileFile(" tests/vulpix-tests/unit/i-dont-exist.scala" , defaultOptions).expectFailure.checkExpectedErrors()
27
- fail(" didn't fail properly" )
28
- }
29
- catch {
30
+ fail()
31
+ } catch {
30
32
case _ : IllegalArgumentException => // pass!
31
- case NonFatal (_) => fail(" wrong exception thrown" )
32
33
}
33
34
34
35
@ Test def pos1Error : Unit =
@@ -77,18 +78,20 @@ class VulpixUnitTests extends ParallelTesting {
77
78
compileFile(" tests/vulpix-tests/unit/deadlock.scala" , defaultOptions).expectFailure.checkRuns()
78
79
79
80
@ Test def badJava : Unit =
80
- try compileFile(" tests/vulpix-tests/unit/BadJava.java" , defaultOptions).suppressAllOutput.checkCompile()
81
- catch {
82
- case ae : AssertionError => assert(ae.getMessage.contains(" java compilation failed" ))
81
+ try {
82
+ compileFile(" tests/vulpix-tests/unit/BadJava.java" , defaultOptions).suppressAllOutput.checkCompile()
83
+ fail()
84
+ } catch {
85
+ case ae : AssertionError => assertTrue(ae.getMessage.contains(" java compilation failed" ))
83
86
}
84
87
85
88
@ Test def runTimeout : Unit = {
86
89
try {
87
90
compileFile(" tests/vulpix-tests/unit/timeout.scala" , defaultOptions).checkRuns()
88
- assert( false , " unreachable " )
91
+ fail( )
89
92
} catch {
90
93
case ae : AssertionError =>
91
- assert (ae.getMessage == " Run test failed, but should not, reasons:\n - test 'tests/vulpix-tests/unit/timeout.scala' timed out" )
94
+ assertEquals (ae.getMessage, " Run test failed, but should not, reasons:\n - test 'tests/vulpix-tests/unit/timeout.scala' timed out" )
92
95
}
93
96
}
94
97
}
0 commit comments