From 942e9fb5c80368fe93ca195bc14272b2d4cd2881 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 8 Jul 2018 20:27:02 +1000 Subject: Squashed 'vendor/compat53/' changes from bc91f40..daebe77 daebe77 Fix feature test for C11 Annex K (strerror_s). d48f7f5 Provide strict lua_tointegerx for Lua 5.2 as well. 340f2f4 lua_tointeger(x) rejects non-ints for Lua 5.1. 30077d2 Verify that lua_getuservalue returns type. git-subtree-dir: vendor/compat53 git-subtree-split: daebe77a2f498817713df37f0bb316db1d82222f --- tests/test.lua | 5 +++++ tests/testmod.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/test.lua b/tests/test.lua index 2f6c7f6..c2c0abf 100755 --- a/tests/test.lua +++ b/tests/test.lua @@ -705,6 +705,11 @@ print("tonumber", mod.tonumber("error")) ___'' print("tointeger", mod.tointeger(12)) +print("tointeger", mod.tointeger(-12)) +print("tointeger", mod.tointeger(12.1)) +print("tointeger", mod.tointeger(12.9)) +print("tointeger", mod.tointeger(-12.1)) +print("tointeger", mod.tointeger(-12.9)) print("tointeger", mod.tointeger("12")) print("tointeger", mod.tointeger("0")) print("tointeger", mod.tointeger(math.pi)) diff --git a/tests/testmod.c b/tests/testmod.c index a0d2e2a..cd56e76 100644 --- a/tests/testmod.c +++ b/tests/testmod.c @@ -152,7 +152,8 @@ static int test_tointeger (lua_State *L) { lua_pushnil(L); else lua_pushinteger(L, n); - return 1; + lua_pushinteger(L, lua_tointeger(L, 1)); + return 2; } static int test_len (lua_State *L) { @@ -225,9 +226,9 @@ static int test_uservalue (lua_State *L) { int ui = lua_gettop(L); lua_newtable(L); lua_setuservalue(L, ui); - lua_getuservalue(L, ui); + lua_pushinteger(L, lua_getuservalue(L, ui)); (void)udata; - return 1; + return 2; } static int test_upvalues (lua_State *L) { -- cgit v1.2.3-59-g8ed1b