diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-04-28 15:29:41 +0200 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-04-28 15:29:41 +0200 |
commit | 5d4b124a2fd10e3c156a5cf440a901cff13bfadf (patch) | |
tree | ebf2de3bf60a37d58de755746ed213f5cd643add /tests/loslib.js | |
parent | 247cd4cc52f48d3d16ad6230eec3b4e94aa03c69 (diff) | |
download | fengari-5d4b124a2fd10e3c156a5cf440a901cff13bfadf.tar.gz fengari-5d4b124a2fd10e3c156a5cf440a901cff13bfadf.tar.bz2 fengari-5d4b124a2fd10e3c156a5cf440a901cff13bfadf.zip |
os.getenv
Diffstat (limited to 'tests/loslib.js')
-rw-r--r-- | tests/loslib.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/loslib.js b/tests/loslib.js index 968a338..c460919 100644 --- a/tests/loslib.js +++ b/tests/loslib.js @@ -34,3 +34,34 @@ test('os.time', function (t) { ); }); + + +test('os.getenv', function (t) { + let luaCode = ` + return os.getenv('HOME') + `, L; + + t.plan(3); + + t.doesNotThrow(function () { + + L = lauxlib.luaL_newstate(); + + lauxlib.luaL_openlibs(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"); + + t.ok( + lua.lua_isstring(L, -1), + "Correct element(s) on the stack" + ); + +}); |