aboutsummaryrefslogtreecommitdiff
path: root/test/smtptest.lua
diff options
context:
space:
mode:
authorCaleb Maclennan <caleb@alerque.com>2023-11-10 09:12:04 +0300
committerCaleb Maclennan <caleb@alerque.com>2023-11-10 09:12:04 +0300
commit5c4fc93d5f4137bf4c22ddf1a048c907a4a26727 (patch)
treea9a68e1f6a9c3bfe2b64fa1c3a4098865b7d3b5d /test/smtptest.lua
parentccef3bc4e2aa6ee5b997a80aabb58f4ff0b0e98f (diff)
parent43a97b7f0053313b43906371dbdc226271e6c8ab (diff)
downloadluasocket-hjelmeland-patch-1.tar.gz
luasocket-hjelmeland-patch-1.tar.bz2
luasocket-hjelmeland-patch-1.zip
Merge branch 'master' into hjelmeland-patch-1hjelmeland-patch-1
Diffstat (limited to 'test/smtptest.lua')
-rw-r--r--test/smtptest.lua20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/smtptest.lua b/test/smtptest.lua
index b5380ff..9d06054 100644
--- a/test/smtptest.lua
+++ b/test/smtptest.lua
@@ -27,8 +27,8 @@ local total = function()
27end 27end
28 28
29local similar = function(s1, s2) 29local similar = function(s1, s2)
30 return 30 return
31 string.lower(string.gsub(s1, "%s", "")) == 31 string.lower(string.gsub(s1, "%s", "")) ==
32 string.lower(string.gsub(s2, "%s", "")) 32 string.lower(string.gsub(s2, "%s", ""))
33end 33end
34 34
@@ -40,9 +40,9 @@ end
40 40
41local readfile = function(name) 41local readfile = function(name)
42 local f = io.open(name, "r") 42 local f = io.open(name, "r")
43 if not f then 43 if not f then
44 fail("unable to open file!") 44 fail("unable to open file!")
45 return nil 45 return nil
46 end 46 end
47 local s = f:read("*a") 47 local s = f:read("*a")
48 f:close() 48 f:close()
@@ -52,7 +52,7 @@ end
52local empty = function() 52local empty = function()
53 for i,v in ipairs(files) do 53 for i,v in ipairs(files) do
54 local f = io.open(v, "w") 54 local f = io.open(v, "w")
55 if not f then 55 if not f then
56 fail("unable to open file!") 56 fail("unable to open file!")
57 end 57 end
58 f:close() 58 f:close()
@@ -116,8 +116,8 @@ local wait = function(sentinel, n)
116 while 1 do 116 while 1 do
117 local mbox = parse(get()) 117 local mbox = parse(get())
118 if n == #mbox then break end 118 if n == #mbox then break end
119 if socket.time() - sentinel.time > 50 then 119 if socket.time() - sentinel.time > 50 then
120 to = 1 120 to = 1
121 break 121 break
122 end 122 end
123 socket.sleep(1) 123 socket.sleep(1)
@@ -132,7 +132,7 @@ local stuffed_body = [[
132This message body needs to be 132This message body needs to be
133stuffed because it has a dot 133stuffed because it has a dot
134. 134.
135by itself on a line. 135by itself on a line.
136Otherwise the mailer would 136Otherwise the mailer would
137think that the dot 137think that the dot
138. 138.
@@ -219,7 +219,7 @@ else print("ok") end
219 219
220io.write("testing invalid from: ") 220io.write("testing invalid from: ")
221local ret, err = socket.smtp.mail{ 221local ret, err = socket.smtp.mail{
222 from = ' " " (( _ * ', 222 from = ' " " (( _ * ',
223 rcpt = rcpt, 223 rcpt = rcpt,
224} 224}
225if ret or not err then fail("wrong error message") 225if ret or not err then fail("wrong error message")
@@ -227,7 +227,7 @@ else print(err) end
227 227
228io.write("testing no rcpt: ") 228io.write("testing no rcpt: ")
229local ret, err = socket.smtp.mail{ 229local ret, err = socket.smtp.mail{
230 from = from, 230 from = from,
231} 231}
232if ret or not err then fail("wrong error message") 232if ret or not err then fail("wrong error message")
233else print(err) end 233else print(err) end