diff options
author | Philipp Janda <siffiejoe@gmx.net> | 2017-09-18 20:04:24 +0200 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2017-09-18 15:04:24 -0300 |
commit | 9cb6834fe07297ba79e7453978cf7e7d8d8c339a (patch) | |
tree | 0d5f92eafd97efaa43b2c0b67b19c7b44c35d424 /tests | |
parent | ee2d198f62aeb52751db934a537ee6b0ef164662 (diff) | |
download | lua-compat-5.3-9cb6834fe07297ba79e7453978cf7e7d8d8c339a.tar.gz lua-compat-5.3-9cb6834fe07297ba79e7453978cf7e7d8d8c339a.tar.bz2 lua-compat-5.3-9cb6834fe07297ba79e7453978cf7e7d8d8c339a.zip |
Add Travis-CI integration
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test.lua | 8 | ||||
-rw-r--r-- | tests/testmod.c | 10 |
2 files changed, 11 insertions, 7 deletions
diff --git a/tests/test.lua b/tests/test.lua index 8fafdf3..2f6c7f6 100755 --- a/tests/test.lua +++ b/tests/test.lua | |||
@@ -40,7 +40,7 @@ local mode = "global" | |||
40 | if arg[1] == "module" then | 40 | if arg[1] == "module" then |
41 | mode = "module" | 41 | mode = "module" |
42 | end | 42 | end |
43 | 43 | local self = arg[0] | |
44 | 44 | ||
45 | package.path = "../?.lua;../?/init.lua" | 45 | package.path = "../?.lua;../?/init.lua" |
46 | package.cpath = "./?-"..V..".so;./?-"..V..".dll;./?.so;./?.dll" | 46 | package.cpath = "./?-"..V..".so;./?-"..V..".dll;./?.so;./?.dll" |
@@ -603,11 +603,11 @@ end | |||
603 | ___'' | 603 | ___'' |
604 | do | 604 | do |
605 | writefile("data.txt", "123 18.8 hello world\ni'm here\n") | 605 | writefile("data.txt", "123 18.8 hello world\ni'm here\n") |
606 | for a,b in io.lines("test.lua", 2, "*l") do | 606 | for a,b in io.lines(self, 2, "*l") do |
607 | print("io.lines()", a, b) | 607 | print("io.lines()", a, b) |
608 | break | 608 | break |
609 | end | 609 | end |
610 | for l in io.lines("test.lua") do | 610 | for l in io.lines(self) do |
611 | print("io.lines()", l) | 611 | print("io.lines()", l) |
612 | break | 612 | break |
613 | end | 613 | end |
@@ -624,7 +624,7 @@ do | |||
624 | for l in io.lines("no_such_file.txt") do print(l) end | 624 | for l in io.lines("no_such_file.txt") do print(l) end |
625 | end)) | 625 | end)) |
626 | if mode ~= "module" then | 626 | if mode ~= "module" then |
627 | local f = assert(io.open("test.lua", "r")) | 627 | local f = assert(io.open(self, "r")) |
628 | for a,b in f:lines(2, "*l") do | 628 | for a,b in f:lines(2, "*l") do |
629 | print("file:lines()", a, b) | 629 | print("file:lines()", a, b) |
630 | break | 630 | break |
diff --git a/tests/testmod.c b/tests/testmod.c index 1034d20..a0d2e2a 100644 --- a/tests/testmod.c +++ b/tests/testmod.c | |||
@@ -1,7 +1,5 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <lua.h> | ||
4 | #include <lauxlib.h> | ||
5 | #include "compat-5.3.h" | 3 | #include "compat-5.3.h" |
6 | 4 | ||
7 | 5 | ||
@@ -12,7 +10,7 @@ static int test_isinteger (lua_State *L) { | |||
12 | 10 | ||
13 | 11 | ||
14 | static int test_rotate (lua_State *L) { | 12 | static int test_rotate (lua_State *L) { |
15 | int r = luaL_checkint(L, 1); | 13 | int r = (int)luaL_checkinteger(L, 1); |
16 | int n = lua_gettop(L)-1; | 14 | int n = lua_gettop(L)-1; |
17 | luaL_argcheck(L, (r < 0 ? -r : r) <= n, 1, "not enough arguments"); | 15 | luaL_argcheck(L, (r < 0 ? -r : r) <= n, 1, "not enough arguments"); |
18 | lua_rotate(L, 2, r); | 16 | lua_rotate(L, 2, r); |
@@ -336,6 +334,9 @@ static const luaL_Reg more_funcs[] = { | |||
336 | }; | 334 | }; |
337 | 335 | ||
338 | 336 | ||
337 | #ifdef __cplusplus | ||
338 | extern "C" { | ||
339 | #endif | ||
339 | int luaopen_testmod (lua_State *L) { | 340 | int luaopen_testmod (lua_State *L) { |
340 | int i = 1; | 341 | int i = 1; |
341 | luaL_newlib(L, funcs); | 342 | luaL_newlib(L, funcs); |
@@ -344,4 +345,7 @@ int luaopen_testmod (lua_State *L) { | |||
344 | luaL_setfuncs(L, more_funcs, NUP); | 345 | luaL_setfuncs(L, more_funcs, NUP); |
345 | return 1; | 346 | return 1; |
346 | } | 347 | } |
348 | #ifdef __cplusplus | ||
349 | } | ||
350 | #endif | ||
347 | 351 | ||