diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2007-03-12 04:08:40 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2007-03-12 04:08:40 +0000 |
| commit | be2e467929be9f27fbe92fe7b94783635c920c06 (patch) | |
| tree | 94054e38f33178d805a6144d3bd9cb76da4a4c76 /test | |
| parent | 8bf9fb51dd09fb066483247fccbfc979acc84071 (diff) | |
| download | luasocket-be2e467929be9f27fbe92fe7b94783635c920c06.tar.gz luasocket-be2e467929be9f27fbe92fe7b94783635c920c06.tar.bz2 luasocket-be2e467929be9f27fbe92fe7b94783635c920c06.zip | |
Couple bug fixes.
Diffstat (limited to 'test')
| -rw-r--r-- | test/httptest.lua | 5 | ||||
| -rw-r--r-- | test/testclnt.lua | 2 | ||||
| -rw-r--r-- | test/testmesg.lua | 12 |
3 files changed, 9 insertions, 10 deletions
diff --git a/test/httptest.lua b/test/httptest.lua index ac60787..dd53ec3 100644 --- a/test/httptest.lua +++ b/test/httptest.lua | |||
| @@ -119,9 +119,8 @@ check_request(request, expect, ignore) | |||
| 119 | 119 | ||
| 120 | ------------------------------------------------------------------------ | 120 | ------------------------------------------------------------------------ |
| 121 | io.write("testing invalid url: ") | 121 | io.write("testing invalid url: ") |
| 122 | local c, e = socket.connect("", 80) | 122 | local r, e = http.request{url = host .. prefix} |
| 123 | local r, re = http.request{url = host .. prefix} | 123 | assert(r == nil and e == "invalid host ''") |
| 124 | assert(r == nil and e == re) | ||
| 125 | r, re = http.request(host .. prefix) | 124 | r, re = http.request(host .. prefix) |
| 126 | assert(r == nil and e == re, tostring(r) ..", " .. tostring(re) .. | 125 | assert(r == nil and e == re, tostring(r) ..", " .. tostring(re) .. |
| 127 | " vs " .. tostring(e)) | 126 | " vs " .. tostring(e)) |
diff --git a/test/testclnt.lua b/test/testclnt.lua index cf71c9f..304cfd3 100644 --- a/test/testclnt.lua +++ b/test/testclnt.lua | |||
| @@ -101,7 +101,7 @@ control:setoption("tcp-nodelay", true) | |||
| 101 | 101 | ||
| 102 | ------------------------------------------------------------------------ | 102 | ------------------------------------------------------------------------ |
| 103 | function test_methods(sock, methods) | 103 | function test_methods(sock, methods) |
| 104 | for _, v in methods do | 104 | for _, v in pairs(methods) do |
| 105 | if type(sock[v]) ~= "function" then | 105 | if type(sock[v]) ~= "function" then |
| 106 | fail(sock.class .. " method '" .. v .. "' not registered") | 106 | fail(sock.class .. " method '" .. v .. "' not registered") |
| 107 | end | 107 | end |
diff --git a/test/testmesg.lua b/test/testmesg.lua index ab85c93..04305f4 100644 --- a/test/testmesg.lua +++ b/test/testmesg.lua | |||
| @@ -12,7 +12,7 @@ source = smtp.message { | |||
| 12 | headers = { ['content-type'] = 'multipart/alternative' }, | 12 | headers = { ['content-type'] = 'multipart/alternative' }, |
| 13 | body = { | 13 | body = { |
| 14 | [1] = { | 14 | [1] = { |
| 15 | headers = { ['content-type'] = 'text/html' }, | 15 | headers = { ['Content-type'] = 'text/html' }, |
| 16 | body = "<html> <body> Hi, <b>there</b>...</body> </html>" | 16 | body = "<html> <body> Hi, <b>there</b>...</body> </html>" |
| 17 | }, | 17 | }, |
| 18 | [2] = { | 18 | [2] = { |
| @@ -60,7 +60,7 @@ source = smtp.message{ | |||
| 60 | -- chunks are loaded into memory and translation happens on the fly. | 60 | -- chunks are loaded into memory and translation happens on the fly. |
| 61 | [2] = { | 61 | [2] = { |
| 62 | headers = { | 62 | headers = { |
| 63 | ["content-type"] = 'image/png; name="luasocket.png"', | 63 | ["ConTenT-tYpE"] = 'image/png; name="luasocket.png"', |
| 64 | ["content-disposition"] = 'attachment; filename="luasocket.png"', | 64 | ["content-disposition"] = 'attachment; filename="luasocket.png"', |
| 65 | ["content-description"] = 'a beautiful image', | 65 | ["content-description"] = 'a beautiful image', |
| 66 | ["content-transfer-encoding"] = "BASE64" | 66 | ["content-transfer-encoding"] = "BASE64" |
| @@ -83,10 +83,10 @@ r, e = smtp.send{ | |||
| 83 | "<diego@princeton.edu>" }, | 83 | "<diego@princeton.edu>" }, |
| 84 | from = "<diego@princeton.edu>", | 84 | from = "<diego@princeton.edu>", |
| 85 | source = ltn12.source.chain(source, filter), | 85 | source = ltn12.source.chain(source, filter), |
| 86 | server = "mail.cs.princeton.edu", | 86 | --server = "mail.cs.princeton.edu", |
| 87 | --server = "localhost", | 87 | --port = 25 |
| 88 | --port = 2525 | 88 | server = "localhost", |
| 89 | port = 25 | 89 | port = 2525 |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | print(r, e) | 92 | print(r, e) |
