diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-06-26 18:47:49 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-06-26 18:47:49 +0000 |
| commit | 71f6bb60bf2b7457091c7106190f92ab7e51f7c6 (patch) | |
| tree | 8ad3668667bd3da3c34f7ff7ae0a9a7a4daa4679 /test/testclnt.lua | |
| parent | f330540576031528f0daac231c61d4dd06e8ba1e (diff) | |
| download | luasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.tar.gz luasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.tar.bz2 luasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.zip | |
Finished implementation of LuaSocket 2.0 alpha on Linux.
Some testing still needed.
Diffstat (limited to 'test/testclnt.lua')
| -rw-r--r-- | test/testclnt.lua | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/test/testclnt.lua b/test/testclnt.lua index b2b4b18..e38c248 100644 --- a/test/testclnt.lua +++ b/test/testclnt.lua | |||
| @@ -17,12 +17,14 @@ function warn(...) | |||
| 17 | io.write("WARNING: ", s, "\n") | 17 | io.write("WARNING: ", s, "\n") |
| 18 | end | 18 | end |
| 19 | 19 | ||
| 20 | pad = string.rep(" ", 8192) | ||
| 21 | |||
| 20 | function remote(...) | 22 | function remote(...) |
| 21 | local s = string.format(unpack(arg)) | 23 | local s = string.format(unpack(arg)) |
| 22 | s = string.gsub(s, "\n", ";") | 24 | s = string.gsub(s, "\n", ";") |
| 23 | s = string.gsub(s, "%s+", " ") | 25 | s = string.gsub(s, "%s+", " ") |
| 24 | s = string.gsub(s, "^%s*", "") | 26 | s = string.gsub(s, "^%s*", "") |
| 25 | control:send(s, "\n") | 27 | control:send(pad, s, "\n") |
| 26 | control:receive() | 28 | control:receive() |
| 27 | end | 29 | end |
| 28 | 30 | ||
| @@ -82,16 +84,19 @@ function reconnect() | |||
| 82 | remote [[ | 84 | remote [[ |
| 83 | if data then data:close() data = nil end | 85 | if data then data:close() data = nil end |
| 84 | data = server:accept() | 86 | data = server:accept() |
| 87 | data:setoption("nodelay", true) | ||
| 85 | ]] | 88 | ]] |
| 86 | data, err = socket.connect(host, port) | 89 | data, err = socket.connect(host, port) |
| 87 | if not data then fail(err) | 90 | if not data then fail(err) |
| 88 | else pass("connected!") end | 91 | else pass("connected!") end |
| 92 | data:setoption("nodelay", true) | ||
| 89 | end | 93 | end |
| 90 | 94 | ||
| 91 | pass("attempting control connection...") | 95 | pass("attempting control connection...") |
| 92 | control, err = socket.connect(host, port) | 96 | control, err = socket.connect(host, port) |
| 93 | if err then fail(err) | 97 | if err then fail(err) |
| 94 | else pass("connected!") end | 98 | else pass("connected!") end |
| 99 | control:setoption("nodelay", true) | ||
| 95 | 100 | ||
| 96 | ------------------------------------------------------------------------ | 101 | ------------------------------------------------------------------------ |
| 97 | test("method registration") | 102 | test("method registration") |
| @@ -157,16 +162,21 @@ remote "data:send(str); data:close()" | |||
| 157 | end | 162 | end |
| 158 | 163 | ||
| 159 | 164 | ||
| 160 | test_mixed(1) | 165 | --test_mixed(1) |
| 161 | test_mixed(17) | 166 | --test_mixed(17) |
| 162 | test_mixed(200) | 167 | --test_mixed(200) |
| 168 | --test_mixed(4091) | ||
| 169 | --test_mixed(80199) | ||
| 170 | --test_mixed(4091) | ||
| 171 | --test_mixed(200) | ||
| 172 | --test_mixed(17) | ||
| 173 | --test_mixed(1) | ||
| 174 | |||
| 175 | test_mixed(4091) | ||
| 176 | test_mixed(4091) | ||
| 177 | test_mixed(4091) | ||
| 163 | test_mixed(4091) | 178 | test_mixed(4091) |
| 164 | test_mixed(80199) | ||
| 165 | test_mixed(4091) | 179 | test_mixed(4091) |
| 166 | test_mixed(200) | ||
| 167 | test_mixed(17) | ||
| 168 | test_mixed(1) | ||
| 169 | |||
| 170 | ------------------------------------------------------------------------ | 180 | ------------------------------------------------------------------------ |
| 171 | test("character line") | 181 | test("character line") |
| 172 | reconnect() | 182 | reconnect() |
