aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-07-07 11:55:12 +1000
committerdaurnimator <quae@daurnimator.com>2018-07-07 12:07:29 +1000
commitb9cb6c4fe614e16debddeed202f5ededc40719bf (patch)
tree81a531f12d7ffea43e4e7828fdad25ad6a5aeba0 /test
parentc60a1cbc5f76a147e74135add574a6a5d63eba7b (diff)
downloadfengari-b9cb6c4fe614e16debddeed202f5ededc40719bf.tar.gz
fengari-b9cb6c4fe614e16debddeed202f5ededc40719bf.tar.bz2
fengari-b9cb6c4fe614e16debddeed202f5ededc40719bf.zip
src/lundump.js: Fix reading empty string constants
Closes https://github.com/fengari-lua/fengari-interop/issues/42
Diffstat (limited to 'test')
-rw-r--r--test/load.test.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/load.test.js b/test/load.test.js
index 3c03eec..d778155 100644
--- a/test/load.test.js
+++ b/test/load.test.js
@@ -43,6 +43,24 @@ test('load', () => {
});
+test('undump empty string', () => {
+ let L = lauxlib.luaL_newstate();
+ if (!L) throw Error("failed to create lua state");
+
+ let luaCode = `
+ assert(load(string.dump(function()
+ local str = ""
+ return #str -- something that inspects the string
+ end)))()
+ `;
+ {
+ lualib.luaL_openlibs(L);
+ expect(lauxlib.luaL_loadstring(L, to_luastring(luaCode))).toBe(lua.LUA_OK);
+ lua.lua_call(L, 0, 0);
+ }
+});
+
+
test('luaL_loadbuffer', () => {
let L = lauxlib.luaL_newstate();
if (!L) throw Error("failed to create lua state");