aboutsummaryrefslogtreecommitdiff
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
parent393e1a61804eb33e57d92cecd31d62afbef47d3f (diff)
downloadfengari-3cb56ad565fca7408eaaacb74fe8ccfcd92729e1.tar.gz
fengari-3cb56ad565fca7408eaaacb74fe8ccfcd92729e1.tar.bz2
fengari-3cb56ad565fca7408eaaacb74fe8ccfcd92729e1.zip
ar.what was not a lua string
-rw-r--r--src/ldebug.js2
-rw-r--r--tests/test-suite/inprogress/coroutine.js36
2 files changed, 37 insertions, 1 deletions
diff --git a/src/ldebug.js b/src/ldebug.js
index 5749951..0f387af 100644
--- a/src/ldebug.js
+++ b/src/ldebug.js
@@ -167,7 +167,7 @@ const funcinfo = function(ar, cl) {
ar.source = defs.to_luastring("=[JS]", true);
ar.linedefined = -1;
ar.lastlinedefined = -1;
- ar.what = "J";
+ ar.what = ["J".charCodeAt(0)];
} else {
let p = cl.p;
ar.source = p.source ? p.source.getstr() : defs.to_luastring("=?", true);
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");
});