aboutsummaryrefslogtreecommitdiff
path: root/testes/db.lua
diff options
context:
space:
mode:
Diffstat (limited to 'testes/db.lua')
-rw-r--r--testes/db.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/testes/db.lua b/testes/db.lua
index 95275fb4..3d94f776 100644
--- a/testes/db.lua
+++ b/testes/db.lua
@@ -734,18 +734,24 @@ a, b = coroutine.resume(co, 100)
734assert(a and b == 30) 734assert(a and b == 30)
735 735
736 736
737-- check traceback of suspended coroutines 737-- check traceback of suspended (or dead with error) coroutines
738
739function f(i)
740 if i == 0 then error(i)
741 else coroutine.yield(); f(i-1)
742 end
743end
738 744
739function f(i) coroutine.yield(i == 0); f(i - 1) end
740 745
741co = coroutine.create(function (x) f(x) end) 746co = coroutine.create(function (x) f(x) end)
742a, b = coroutine.resume(co, 3) 747a, b = coroutine.resume(co, 3)
743t = {"'coroutine.yield'", "'f'", "in function <"} 748t = {"'coroutine.yield'", "'f'", "in function <"}
744repeat 749while coroutine.status(co) == "suspended" do
745 checktraceback(co, t) 750 checktraceback(co, t)
746 a, b = coroutine.resume(co) 751 a, b = coroutine.resume(co)
747 table.insert(t, 2, "'f'") -- one more recursive call to 'f' 752 table.insert(t, 2, "'f'") -- one more recursive call to 'f'
748until b 753end
754t[1] = "'error'"
749checktraceback(co, t) 755checktraceback(co, t)
750 756
751 757