aboutsummaryrefslogtreecommitdiff
path: root/test/loslib.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/loslib.test.js')
-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 a270d49..5f06a06 100644
--- a/test/loslib.test.js
+++ b/test/loslib.test.js
@@ -84,6 +84,27 @@ test('os.date', () => {
});
+test('os.date normalisation', () => {
+ let L = lauxlib.luaL_newstate();
+ if (!L) throw Error("failed to create lua state");
+
+ let luaCode = `
+ return os.date('%Y-%m-%d', os.time({
+ day = 0,
+ month = 0,
+ year = 2014
+ }))
+ `;
+ {
+ lualib.luaL_openlibs(L);
+ expect(lauxlib.luaL_loadstring(L, to_luastring(luaCode))).toBe(lua.LUA_OK);
+ lua.lua_call(L, 0, -1);
+ }
+
+ expect(lua.lua_tojsstring(L, -1)).toBe("2013-11-30");
+});
+
+
test('os.getenv', () => {
let L = lauxlib.luaL_newstate();
if (!L) throw Error("failed to create lua state");