feat: add input validation and stack trace filtering for Timer.sleep

Add type and range checks to Timer.sleep() in both C source and Wren
implementation, aborting with descriptive errors for non-numeric or
negative arguments. Introduce six new test files covering sleep with
fibers, float durations, main fiber, zero milliseconds, negative
values, and non-numeric input. Fix stack trace parsing in test runner
to skip builtin library frames by iterating through error lines until
a main-line match is found.
This commit is contained in:
Bob Nystrom
2015-08-08 14:17:30 +00:00
parent 810da1f0fc
commit 664a166d6c
10 changed files with 95 additions and 5 deletions
+27
View File
@@ -0,0 +1,27 @@
import "timer" for Timer
Fiber.new {
Timer.sleep(0)
IO.print("a")
}.call()
Fiber.new {
Timer.sleep(0)
IO.print("b")
}.call()
Fiber.new {
Timer.sleep(0)
IO.print("c")
}.call()
IO.print("main")
Timer.sleep(0) // This is enough to let the other fiber run.
IO.print("done")
// expect: main
// Run in the order they were enqueued.
// expect: a
// expect: b
// expect: c
// expect: done