From e15ed19db6eb3385c1b35219c2dfa11953c3d47e Mon Sep 17 00:00:00 2001 From: Liam Devine Date: Mon, 4 Jul 2011 23:31:14 +0100 Subject: Compiles with Lua 5.1.4 and Lua 5.2.0-beta, although the makefile needs sorting out to take maybe a version number and also the local paths need removing. --- test/testclnt.lua | 15 ++++++++++----- test/testsrvr.lua | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/testclnt.lua b/test/testclnt.lua index 4c2f211..ad3741a 100644 --- a/test/testclnt.lua +++ b/test/testclnt.lua @@ -4,8 +4,7 @@ host = host or "localhost" port = port or "8383" function printf(...) - local s = string.format(unpack(arg)) - io.stderr:write(s) + io.stderr:write(string.format(...)) end function pass(...) @@ -21,12 +20,12 @@ function fail(...) end function warn(...) - local s = string.format(unpack(arg)) + local s = string.format(...) io.stderr:write("WARNING: ", s, "\n") end function remote(...) - local s = string.format(unpack(arg)) + local s = string.format(...) s = string.gsub(s, "\n", ";") s = string.gsub(s, "%s+", " ") s = string.gsub(s, "^%s*", "") @@ -141,6 +140,9 @@ remote "data:send(str); data:close()" end ------------------------------------------------------------------------ +if not math.mod then + math.mod = math.fmod +end function test_asciiline(len) reconnect() io.stderr:write("length " .. len .. ": ") @@ -445,7 +447,10 @@ end ------------------------------------------------------------------------ function rebind_test() - local c = socket.bind("localhost", 0) + local c ,c1 = socket.bind("localhost", 0) + if not c then pass ("failed to bind! " .. c .. ' ' .. c1) return end + assert(c,c1) + local i, p = c:getsockname() local s, e = socket.tcp() assert(s, e) diff --git a/test/testsrvr.lua b/test/testsrvr.lua index f1972c2..7ddff6e 100644 --- a/test/testsrvr.lua +++ b/test/testsrvr.lua @@ -10,6 +10,6 @@ while 1 do command = assert(control:receive()); assert(control:send(ack)); print(command); - (loadstring(command))(); + (load(command))(); end end -- cgit v1.2.3-55-g6feb