diff options
author | Caleb Maclennan <caleb@alerque.com> | 2023-11-10 09:12:04 +0300 |
---|---|---|
committer | Caleb Maclennan <caleb@alerque.com> | 2023-11-10 09:12:04 +0300 |
commit | 5c4fc93d5f4137bf4c22ddf1a048c907a4a26727 (patch) | |
tree | a9a68e1f6a9c3bfe2b64fa1c3a4098865b7d3b5d /test/smtptest.lua | |
parent | ccef3bc4e2aa6ee5b997a80aabb58f4ff0b0e98f (diff) | |
parent | 43a97b7f0053313b43906371dbdc226271e6c8ab (diff) | |
download | luasocket-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.lua | 20 |
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() | |||
27 | end | 27 | end |
28 | 28 | ||
29 | local similar = function(s1, s2) | 29 | local 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", "")) |
33 | end | 33 | end |
34 | 34 | ||
@@ -40,9 +40,9 @@ end | |||
40 | 40 | ||
41 | local readfile = function(name) | 41 | local 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 | |||
52 | local empty = function() | 52 | local 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 = [[ | |||
132 | This message body needs to be | 132 | This message body needs to be |
133 | stuffed because it has a dot | 133 | stuffed because it has a dot |
134 | . | 134 | . |
135 | by itself on a line. | 135 | by itself on a line. |
136 | Otherwise the mailer would | 136 | Otherwise the mailer would |
137 | think that the dot | 137 | think that the dot |
138 | . | 138 | . |
@@ -219,7 +219,7 @@ else print("ok") end | |||
219 | 219 | ||
220 | io.write("testing invalid from: ") | 220 | io.write("testing invalid from: ") |
221 | local ret, err = socket.smtp.mail{ | 221 | local ret, err = socket.smtp.mail{ |
222 | from = ' " " (( _ * ', | 222 | from = ' " " (( _ * ', |
223 | rcpt = rcpt, | 223 | rcpt = rcpt, |
224 | } | 224 | } |
225 | if ret or not err then fail("wrong error message") | 225 | if ret or not err then fail("wrong error message") |
@@ -227,7 +227,7 @@ else print(err) end | |||
227 | 227 | ||
228 | io.write("testing no rcpt: ") | 228 | io.write("testing no rcpt: ") |
229 | local ret, err = socket.smtp.mail{ | 229 | local ret, err = socket.smtp.mail{ |
230 | from = from, | 230 | from = from, |
231 | } | 231 | } |
232 | if ret or not err then fail("wrong error message") | 232 | if ret or not err then fail("wrong error message") |
233 | else print(err) end | 233 | else print(err) end |