aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-04-22 21:00:58 +1000
committerdaurnimator <quae@daurnimator.com>2018-04-22 21:20:45 +1000
commitf6a9b5adb12fe92ebaaa20d9707d7945406ae533 (patch)
tree07b80eef5144a2b8332513392093c6858b25511e /test
parent8ffcac749ad1153fd01cc7c0d40a338090bd1c38 (diff)
downloadfengari-f6a9b5adb12fe92ebaaa20d9707d7945406ae533.tar.gz
fengari-f6a9b5adb12fe92ebaaa20d9707d7945406ae533.tar.bz2
fengari-f6a9b5adb12fe92ebaaa20d9707d7945406ae533.zip
src/loslib.js: Fix off-by-one error in month field of os.time()
Diffstat (limited to 'test')
-rw-r--r--test/loslib.test.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/loslib.test.js b/test/loslib.test.js
index 5f06a06..abb5ef2 100644
--- a/test/loslib.test.js
+++ b/test/loslib.test.js
@@ -105,6 +105,27 @@ test('os.date normalisation', () => {
});
+test('os.time normalisation of table', () => {
+ let L = lauxlib.luaL_newstate();
+ if (!L) throw Error("failed to create lua state");
+
+ let luaCode = `
+ local t = {
+ day = 20,
+ month = 2,
+ year = 2018
+ }
+ os.time(t)
+ assert(t.day == 20, "unmodified day")
+ assert(t.month == 2, "unmodified month")
+ assert(t.year == 2018, "unmodified year")
+ `;
+ lualib.luaL_openlibs(L);
+ expect(lauxlib.luaL_loadstring(L, to_luastring(luaCode))).toBe(lua.LUA_OK);
+ lua.lua_call(L, 0, 0);
+});
+
+
test('os.getenv', () => {
let L = lauxlib.luaL_newstate();
if (!L) throw Error("failed to create lua state");