Skip to content

Commit cf8bbb3

Browse files
Address review
1 parent e2dd138 commit cf8bbb3

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

compiler/test/dotty/tools/vulpix/VulpixUnitTests.scala

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ class VulpixUnitTests extends ParallelTesting {
2121
def isInteractive = !sys.env.contains("DRONE")
2222
def testFilter = None
2323

24+
// To fail with something else than an AssertionError
25+
def fail(): Unit = throw new Exception("didn't fail properly")
26+
2427
@Test def missingFile: Unit =
2528
try {
2629
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 {
3032
case _: IllegalArgumentException => // pass!
31-
case NonFatal(_) => fail("wrong exception thrown")
3233
}
3334

3435
@Test def pos1Error: Unit =
@@ -77,18 +78,20 @@ class VulpixUnitTests extends ParallelTesting {
7778
compileFile("tests/vulpix-tests/unit/deadlock.scala", defaultOptions).expectFailure.checkRuns()
7879

7980
@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"))
8386
}
8487

8588
@Test def runTimeout: Unit = {
8689
try {
8790
compileFile("tests/vulpix-tests/unit/timeout.scala", defaultOptions).checkRuns()
88-
assert(false, "unreachable")
91+
fail()
8992
} catch {
9093
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")
9295
}
9396
}
9497
}

project/scripts/cmdTests

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ if ./project/scripts/sbt "dotty-compiler/testOnly dotty.tools.vulpix.VulpixMetaT
102102
fi
103103
tmp1=$(mktemp)
104104
cat "$tmp" | sed '/Test run started/,$!d' > "$tmp1"
105+
set +x # Or the code below produces too much noise
105106
while read expected <&4 && read actual <&3; do
106107
if [[ "$expected" != *"SKIP" ]]; then
107108
if [ "$actual" != "$expected" ]; then

0 commit comments

Comments
 (0)