diff options
author | daurnimator <quae@daurnimator.com> | 2018-07-08 20:27:02 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2018-07-08 20:27:02 +1000 |
commit | 942e9fb5c80368fe93ca195bc14272b2d4cd2881 (patch) | |
tree | 5d3e140408e31e79177eca74e27ce4abc2f224e7 /tests | |
parent | 18b7d200cbaadf7aee592f739e2e0cb4be4ce298 (diff) | |
download | luaossl-942e9fb5c80368fe93ca195bc14272b2d4cd2881.tar.gz luaossl-942e9fb5c80368fe93ca195bc14272b2d4cd2881.tar.bz2 luaossl-942e9fb5c80368fe93ca195bc14272b2d4cd2881.zip |
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
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test.lua | 5 | ||||
-rw-r--r-- | tests/testmod.c | 7 |
2 files changed, 9 insertions, 3 deletions
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) { |