aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test.lua5
-rw-r--r--tests/testmod.c7
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) {