aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/httptest.lua5
-rw-r--r--test/testclnt.lua2
-rw-r--r--test/testmesg.lua12
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------------------------------------------------------------------------
121io.write("testing invalid url: ") 121io.write("testing invalid url: ")
122local c, e = socket.connect("", 80) 122local r, e = http.request{url = host .. prefix}
123local r, re = http.request{url = host .. prefix} 123assert(r == nil and e == "invalid host ''")
124assert(r == nil and e == re)
125r, re = http.request(host .. prefix) 124r, re = http.request(host .. prefix)
126assert(r == nil and e == re, tostring(r) ..", " .. tostring(re) .. 125assert(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------------------------------------------------------------------------
103function test_methods(sock, methods) 103function 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
92print(r, e) 92print(r, e)