aboutsummaryrefslogtreecommitdiff
path: root/test/testclnt.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/testclnt.lua')
-rw-r--r--test/testclnt.lua15
1 files changed, 10 insertions, 5 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)