summaryrefslogtreecommitdiff
path: root/tests/test-suite/inprogress/coroutine.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-25 15:11:21 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-25 15:11:21 +0200
commit3cb56ad565fca7408eaaacb74fe8ccfcd92729e1 (patch)
tree514b4ce1a7ea9d0db32eca395e8f6b30cf177076 /tests/test-suite/inprogress/coroutine.js
parent393e1a61804eb33e57d92cecd31d62afbef47d3f (diff)
downloadfengari-3cb56ad565fca7408eaaacb74fe8ccfcd92729e1.tar.gz
fengari-3cb56ad565fca7408eaaacb74fe8ccfcd92729e1.tar.bz2
fengari-3cb56ad565fca7408eaaacb74fe8ccfcd92729e1.zip
ar.what was not a lua string
Diffstat (limited to 'tests/test-suite/inprogress/coroutine.js')
-rw-r--r--tests/test-suite/inprogress/coroutine.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test-suite/inprogress/coroutine.js b/tests/test-suite/inprogress/coroutine.js
index 93be6df..8bf2664 100644
--- a/tests/test-suite/inprogress/coroutine.js
+++ b/tests/test-suite/inprogress/coroutine.js
@@ -1161,6 +1161,42 @@ test("[test-suite] coroutine: testing debug library on a coroutine suspended ins
});
+test("[test-suite] coroutine: testing debug library on last function in a suspended coroutine", function (t) {
+ let luaCode = `
+ do
+ -- testing debug library on last function in a suspended coroutine
+ -- (bug in 5.2/5.3)
+ local c = coroutine.create(function () T.testC("yield 1", 10, 20) end)
+ local a, b = coroutine.resume(c)
+ assert(a and b == 20)
+ assert(debug.getinfo(c, 0).linedefined == -1)
+ a, b = debug.getlocal(c, 0, 2)
+ assert(b == 10)
+ end
+ `, L;
+
+ t.plan(2);
+
+ t.doesNotThrow(function () {
+
+ L = lauxlib.luaL_newstate();
+
+ lualib.luaL_openlibs(L);
+
+ ltests.luaopen_tests(L);
+
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
+
+ }, "Lua program loaded without error");
+
+ t.doesNotThrow(function () {
+
+ lua.lua_call(L, 0, -1);
+
+ }, "Lua program ran without error");
+});
+
+
test("[test-suite] coroutine: tests for coroutine API", { skip: true }, function (t) {
t.comment("TODO");
});