aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLiam Devine <dmail00@gmail.com>2011-07-04 23:31:14 +0100
committerSam Roberts <vieuxtech@gmail.com>2012-04-11 13:33:34 -0700
commite15ed19db6eb3385c1b35219c2dfa11953c3d47e (patch)
tree4e38a0b05ac7cbaaa449f2b32dc959409ceae9ea /test
parenta984607f28d0a802acaf1a16da225234af769baa (diff)
downloadluasocket-e15ed19db6eb3385c1b35219c2dfa11953c3d47e.tar.gz
luasocket-e15ed19db6eb3385c1b35219c2dfa11953c3d47e.tar.bz2
luasocket-e15ed19db6eb3385c1b35219c2dfa11953c3d47e.zip
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.
Diffstat (limited to 'test')
-rw-r--r--test/testclnt.lua15
-rw-r--r--test/testsrvr.lua2
2 files changed, 11 insertions, 6 deletions
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"
4port = port or "8383" 4port = port or "8383"
5 5
6function printf(...) 6function printf(...)
7 local s = string.format(unpack(arg)) 7 io.stderr:write(string.format(...))
8 io.stderr:write(s)
9end 8end
10 9
11function pass(...) 10function pass(...)
@@ -21,12 +20,12 @@ function fail(...)
21end 20end
22 21
23function warn(...) 22function warn(...)
24 local s = string.format(unpack(arg)) 23 local s = string.format(...)
25 io.stderr:write("WARNING: ", s, "\n") 24 io.stderr:write("WARNING: ", s, "\n")
26end 25end
27 26
28function remote(...) 27function remote(...)
29 local s = string.format(unpack(arg)) 28 local s = string.format(...)
30 s = string.gsub(s, "\n", ";") 29 s = string.gsub(s, "\n", ";")
31 s = string.gsub(s, "%s+", " ") 30 s = string.gsub(s, "%s+", " ")
32 s = string.gsub(s, "^%s*", "") 31 s = string.gsub(s, "^%s*", "")
@@ -141,6 +140,9 @@ remote "data:send(str); data:close()"
141end 140end
142 141
143------------------------------------------------------------------------ 142------------------------------------------------------------------------
143if not math.mod then
144 math.mod = math.fmod
145end
144function test_asciiline(len) 146function test_asciiline(len)
145 reconnect() 147 reconnect()
146 io.stderr:write("length " .. len .. ": ") 148 io.stderr:write("length " .. len .. ": ")
@@ -445,7 +447,10 @@ end
445 447
446------------------------------------------------------------------------ 448------------------------------------------------------------------------
447function rebind_test() 449function rebind_test()
448 local c = socket.bind("localhost", 0) 450 local c ,c1 = socket.bind("localhost", 0)
451 if not c then pass ("failed to bind! " .. c .. ' ' .. c1) return end
452 assert(c,c1)
453
449 local i, p = c:getsockname() 454 local i, p = c:getsockname()
450 local s, e = socket.tcp() 455 local s, e = socket.tcp()
451 assert(s, e) 456 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
10 command = assert(control:receive()); 10 command = assert(control:receive());
11 assert(control:send(ack)); 11 assert(control:send(ack));
12 print(command); 12 print(command);
13 (loadstring(command))(); 13 (load(command))();
14 end 14 end
15end 15end