Skip to content

Commit

Permalink
added test for correct stack-trace from the hof argument
Browse files Browse the repository at this point in the history
  • Loading branch information
rssh committed Oct 22, 2023
1 parent 95bf6a6 commit 4348305
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class TestBasicStacktraceReporting {
throw new RuntimeException("test")
x+y
}
val endPos = SourcePos.current

val r = c.run()
assert(r.isFailure)
Expand All @@ -25,8 +24,28 @@ class TestBasicStacktraceReporting {
//ex.printStackTrace()
//println(s"startPos = ${startPos}")
assert(ex.getStackTrace().exists(_.getLineNumber() == startPos.line + 4))
case Success(e) =>
assert(false)
}

@Test
def testStackTraceFromHOFunArg() = {
val startPos = SourcePos.current
val c = async[ComputationBound] {
val x = List(1,2,3).map{ x =>
if (x%2) == 1 then throw new RuntimeException("test") else x + await(T1.cbi(1))
}
x
}
val r = c.run()
r match
case Failure(ex) =>
//ex.printStackTrace()
//println(s"startPos = ${startPos}")
assert(ex.getStackTrace().exists(_.getLineNumber() == startPos.line + 3))
case Success(e) =>
assert(false)

}

}

0 comments on commit 4348305

Please sign in to comment.