mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 14:18:42 +01:00
Add support for Fiber.try(_) (#835)
* Add support for Fiber.try(_) * Add documentation for Fiber.try(_) * Add another test for Fiber.try(_)
This commit is contained in:
committed by
GitHub
parent
473392a56a
commit
f5339993ce
12
test/core/fiber/try_value.wren
Normal file
12
test/core/fiber/try_value.wren
Normal file
@ -0,0 +1,12 @@
|
||||
var fiber = Fiber.new {|v|
|
||||
System.print("before")
|
||||
System.print(v)
|
||||
true.unknownMethod
|
||||
System.print("after")
|
||||
}
|
||||
|
||||
System.print(fiber.try("value"))
|
||||
// expect: before
|
||||
// expect: value
|
||||
// expect: Bool does not implement 'unknownMethod'.
|
||||
System.print("after try") // expect: after try
|
||||
16
test/core/fiber/try_value_yield.wren
Normal file
16
test/core/fiber/try_value_yield.wren
Normal file
@ -0,0 +1,16 @@
|
||||
var fiber = Fiber.new {|v|
|
||||
System.print("before")
|
||||
System.print(v)
|
||||
v = Fiber.yield()
|
||||
System.print(v)
|
||||
true.unknownMethod
|
||||
System.print("after")
|
||||
}
|
||||
|
||||
fiber.try("value1")
|
||||
// expect: before
|
||||
// expect: value1
|
||||
System.print(fiber.try("value2"))
|
||||
// expect: value2
|
||||
// expect: Bool does not implement 'unknownMethod'.
|
||||
System.print("after try") // expect: after try
|
||||
Reference in New Issue
Block a user