From c3c1ab50646165c0e43784acb30a353dc5b40d12 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Mon, 6 Mar 2017 11:00:22 +0100 Subject: string.upper/lower --- tests/lstrlib.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'tests') diff --git a/tests/lstrlib.js b/tests/lstrlib.js index 494b881..7120525 100644 --- a/tests/lstrlib.js +++ b/tests/lstrlib.js @@ -73,6 +73,43 @@ test('string.char', function (t) { }, "Lua program ran without error"); + t.strictEqual( + lapi.lua_tostring(L, -1), + "hello", + "Correct element(s) on the stack" + ); +}); + + +test('string.upper, string.lower', function (t) { + let luaCode = ` + return string.upper("hello"), string.lower("HELLO") + `, L; + + t.plan(4); + + t.doesNotThrow(function () { + + L = lauxlib.luaL_newstate(); + + linit.luaL_openlibs(L); + + lauxlib.luaL_loadstring(L, luaCode); + + }, "Lua program loaded without error"); + + t.doesNotThrow(function () { + + lapi.lua_call(L, 0, -1); + + }, "Lua program ran without error"); + + t.strictEqual( + lapi.lua_tostring(L, -2), + "HELLO", + "Correct element(s) on the stack" + ); + t.strictEqual( lapi.lua_tostring(L, -1), "hello", -- cgit v1.2.3-54-g00ecf