Skip to content

Commit 8e0f219

Browse files
Add Vulpix timeout unit test
1 parent 4c407aa commit 8e0f219

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

compiler/test/dotty/tools/vulpix/VulpixTests.scala renamed to compiler/test/dotty/tools/vulpix/VulpixUnitTests.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import scala.concurrent.duration._
88
import scala.util.control.NonFatal
99

1010
/** Unit tests for the Vulpix test suite */
11-
class VulpixTests extends ParallelTesting {
11+
class VulpixUnitTests extends ParallelTesting {
1212
import TestConfiguration._
1313

1414
implicit val _: SummaryReporting = new NoSummaryReport
@@ -81,4 +81,14 @@ class VulpixTests extends ParallelTesting {
8181
catch {
8282
case ae: AssertionError => assert(ae.getMessage.contains("java compilation failed"))
8383
}
84+
85+
@Test def runTimeout: Unit = {
86+
try {
87+
compileFile("../tests/partest-test/timeout.scala", defaultOptions).checkRuns()
88+
assert(false, "unreachable")
89+
} catch {
90+
case ae: AssertionError =>
91+
assert(ae.getMessage == "Run test failed, but should not, reasons:\n - test '../tests/partest-test/timeout.scala' timed out")
92+
}
93+
}
8494
}

tests/partest-test/timeout.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object Test {
2+
def main(args: Array[String]): Unit = {
3+
Thread.sleep(10 * 1000)
4+
}
5+
}

0 commit comments

Comments
 (0)