diff options
author | Philipp Janda <siffiejoe@gmx.net> | 2018-01-13 19:57:19 +0100 |
---|---|---|
committer | Philipp Janda <siffiejoe@gmx.net> | 2018-01-13 19:57:19 +0100 |
commit | 340f2f4777e8ad427a364c9c1ef562d40c60cb1d (patch) | |
tree | 1be2cc11bf9d2d59e5973faa466563a649bdc5e4 /tests | |
parent | 30077d241b788b644fb923b4c2da628cdd2c3423 (diff) | |
download | lua-compat-5.3-340f2f4777e8ad427a364c9c1ef562d40c60cb1d.tar.gz lua-compat-5.3-340f2f4777e8ad427a364c9c1ef562d40c60cb1d.tar.bz2 lua-compat-5.3-340f2f4777e8ad427a364c9c1ef562d40c60cb1d.zip |
lua_tointeger(x) rejects non-ints for Lua 5.1.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test.lua | 5 | ||||
-rw-r--r-- | tests/testmod.c | 3 |
2 files changed, 7 insertions, 1 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")) | |||
705 | 705 | ||
706 | ___'' | 706 | ___'' |
707 | print("tointeger", mod.tointeger(12)) | 707 | print("tointeger", mod.tointeger(12)) |
708 | print("tointeger", mod.tointeger(-12)) | ||
709 | print("tointeger", mod.tointeger(12.1)) | ||
710 | print("tointeger", mod.tointeger(12.9)) | ||
711 | print("tointeger", mod.tointeger(-12.1)) | ||
712 | print("tointeger", mod.tointeger(-12.9)) | ||
708 | print("tointeger", mod.tointeger("12")) | 713 | print("tointeger", mod.tointeger("12")) |
709 | print("tointeger", mod.tointeger("0")) | 714 | print("tointeger", mod.tointeger("0")) |
710 | print("tointeger", mod.tointeger(math.pi)) | 715 | print("tointeger", mod.tointeger(math.pi)) |
diff --git a/tests/testmod.c b/tests/testmod.c index 9232682..cd56e76 100644 --- a/tests/testmod.c +++ b/tests/testmod.c | |||
@@ -152,7 +152,8 @@ static int test_tointeger (lua_State *L) { | |||
152 | lua_pushnil(L); | 152 | lua_pushnil(L); |
153 | else | 153 | else |
154 | lua_pushinteger(L, n); | 154 | lua_pushinteger(L, n); |
155 | return 1; | 155 | lua_pushinteger(L, lua_tointeger(L, 1)); |
156 | return 2; | ||
156 | } | 157 | } |
157 | 158 | ||
158 | static int test_len (lua_State *L) { | 159 | static int test_len (lua_State *L) { |