diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/stufftest.lua | 6 | ||||
| -rw-r--r-- | test/testmesg.lua | 4 | ||||
| -rw-r--r-- | test/tftptest.lua | 4 |
3 files changed, 9 insertions, 5 deletions
diff --git a/test/stufftest.lua b/test/stufftest.lua index 5eb8005..6bd1f91 100644 --- a/test/stufftest.lua +++ b/test/stufftest.lua | |||
| @@ -1,11 +1,13 @@ | |||
| 1 | smtp = require("smtp") | ||
| 2 | |||
| 1 | function test_dot(original, right) | 3 | function test_dot(original, right) |
| 2 | local result, n = socket.smtp.dot(2, original) | 4 | local result, n = smtp.dot(2, original) |
| 3 | assert(result == right, "->" .. result .. "<-") | 5 | assert(result == right, "->" .. result .. "<-") |
| 4 | print("ok") | 6 | print("ok") |
| 5 | end | 7 | end |
| 6 | 8 | ||
| 7 | function test_stuff(original, right) | 9 | function test_stuff(original, right) |
| 8 | local result, n = socket.smtp.dot(2, original) | 10 | local result, n = smtp.dot(2, original) |
| 9 | assert(result == right, "->" .. result .. "<-") | 11 | assert(result == right, "->" .. result .. "<-") |
| 10 | print("ok") | 12 | print("ok") |
| 11 | end | 13 | end |
diff --git a/test/testmesg.lua b/test/testmesg.lua index 449f4c2..3e4c28f 100644 --- a/test/testmesg.lua +++ b/test/testmesg.lua | |||
| @@ -14,7 +14,7 @@ source = smtp.message{ | |||
| 14 | }, | 14 | }, |
| 15 | body = { | 15 | body = { |
| 16 | preamble = "If your client doesn't understand attachments, \r\n" .. | 16 | preamble = "If your client doesn't understand attachments, \r\n" .. |
| 17 | "it will still display the preamble and the epilogue.\r\n", | 17 | "it will still display the preamble and the epilogue.\r\n" .. |
| 18 | "Preamble might show up even in a MIME enabled client.", | 18 | "Preamble might show up even in a MIME enabled client.", |
| 19 | -- first part: No headers means plain text, us-ascii. | 19 | -- first part: No headers means plain text, us-ascii. |
| 20 | -- The mime.eol low-level filter normalizes end-of-line markers. | 20 | -- The mime.eol low-level filter normalizes end-of-line markers. |
| @@ -55,3 +55,5 @@ r, e = smtp.send{ | |||
| 55 | source = source, | 55 | source = source, |
| 56 | server = "mail.cs.princeton.edu" | 56 | server = "mail.cs.princeton.edu" |
| 57 | } | 57 | } |
| 58 | |||
| 59 | print(r, e) | ||
diff --git a/test/tftptest.lua b/test/tftptest.lua index a478ed8..f0dbd82 100644 --- a/test/tftptest.lua +++ b/test/tftptest.lua | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | -- load tftpclnt.lua | 1 | -- load tftpclnt.lua |
| 2 | dofile("tftp.lua") | 2 | local tftp = require("tftp") |
| 3 | 3 | ||
| 4 | -- needs tftp server running on localhost, with root pointing to | 4 | -- needs tftp server running on localhost, with root pointing to |
| 5 | -- a directory with index.html in it | 5 | -- a directory with index.html in it |
| @@ -13,7 +13,7 @@ function readfile(file) | |||
| 13 | end | 13 | end |
| 14 | 14 | ||
| 15 | host = host or "localhost" | 15 | host = host or "localhost" |
| 16 | retrieved, err = socket.tftp.get("tftp://" .. host .."/index.html") | 16 | retrieved, err = tftp.get("tftp://" .. host .."/index.html") |
| 17 | assert(not err, err) | 17 | assert(not err, err) |
| 18 | original = readfile("test/index.html") | 18 | original = readfile("test/index.html") |
| 19 | assert(original == retrieved, "files differ!") | 19 | assert(original == retrieved, "files differ!") |
