diff options
| author | Liam Devine <dmail00@gmail.com> | 2011-07-04 23:31:14 +0100 |
|---|---|---|
| committer | Sam Roberts <vieuxtech@gmail.com> | 2012-04-11 13:33:34 -0700 |
| commit | e15ed19db6eb3385c1b35219c2dfa11953c3d47e (patch) | |
| tree | 4e38a0b05ac7cbaaa449f2b32dc959409ceae9ea /test | |
| parent | a984607f28d0a802acaf1a16da225234af769baa (diff) | |
| download | luasocket-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.lua | 15 | ||||
| -rw-r--r-- | test/testsrvr.lua | 2 |
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" | |||
| 4 | port = port or "8383" | 4 | port = port or "8383" |
| 5 | 5 | ||
| 6 | function printf(...) | 6 | function printf(...) |
| 7 | local s = string.format(unpack(arg)) | 7 | io.stderr:write(string.format(...)) |
| 8 | io.stderr:write(s) | ||
| 9 | end | 8 | end |
| 10 | 9 | ||
| 11 | function pass(...) | 10 | function pass(...) |
| @@ -21,12 +20,12 @@ function fail(...) | |||
| 21 | end | 20 | end |
| 22 | 21 | ||
| 23 | function warn(...) | 22 | function 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") |
| 26 | end | 25 | end |
| 27 | 26 | ||
| 28 | function remote(...) | 27 | function 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()" | |||
| 141 | end | 140 | end |
| 142 | 141 | ||
| 143 | ------------------------------------------------------------------------ | 142 | ------------------------------------------------------------------------ |
| 143 | if not math.mod then | ||
| 144 | math.mod = math.fmod | ||
| 145 | end | ||
| 144 | function test_asciiline(len) | 146 | function 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 | ------------------------------------------------------------------------ |
| 447 | function rebind_test() | 449 | function 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 |
| 15 | end | 15 | end |
