From b32d8ec4d12f48ff4930f5b98b744661f974b0d4 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sat, 17 Jun 2017 17:25:37 +1000 Subject: tests/test-suite/pm.js: Use luaL_loadfile instead of loadstring containing loadfile --- tests/test-suite/pm.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'tests/test-suite') diff --git a/tests/test-suite/pm.js b/tests/test-suite/pm.js index a8a58cd..6b9c767 100644 --- a/tests/test-suite/pm.js +++ b/tests/test-suite/pm.js @@ -202,11 +202,8 @@ test("[test-suite] pm: range", function (t) { // Can't be represented by JS string, testing from actual lua file test("[test-suite] pm: classes", function (t) { - let luaCode = ` - local f = loadfile("tests/test-suite/pm-classes.lua") - return f() - `, L; - + let L; + t.plan(2); t.doesNotThrow(function () { @@ -215,7 +212,7 @@ test("[test-suite] pm: classes", function (t) { lualib.luaL_openlibs(L); - lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); + lauxlib.luaL_loadfile(L, lua.to_luastring("tests/test-suite/pm-classes.lua")); }, "Lua program loaded without error"); @@ -229,11 +226,8 @@ test("[test-suite] pm: classes", function (t) { // Can't be represented by JS string, testing from actual lua file test("[test-suite] pm: gsub", function (t) { - let luaCode = ` - local f = loadfile("tests/test-suite/pm-gsub.lua") - return f() - `, L; - + let L; + t.plan(2); t.doesNotThrow(function () { @@ -242,7 +236,7 @@ test("[test-suite] pm: gsub", function (t) { lualib.luaL_openlibs(L); - lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); + lauxlib.luaL_loadfile(L, lua.to_luastring("tests/test-suite/pm-gsub.lua")); }, "Lua program loaded without error"); -- cgit v1.2.3-70-g09d2