From c51d4acf1c2a8675a3bb043e799ff4390cef47d6 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Sat, 16 Aug 2003 00:06:04 +0000 Subject: Adjusted a few inconsistencies with the manual. --- test/smtptest.lua | 16 ++++++++-------- test/testclnt.lua | 22 +++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/test/smtptest.lua b/test/smtptest.lua index 09bf634..8468408 100644 --- a/test/smtptest.lua +++ b/test/smtptest.lua @@ -209,27 +209,27 @@ insert(sent, { io.write("testing host not found: ") local c, e = socket.connect("wrong.host", 25) -local err = socket.smtp.mail{ +local ret, err = socket.smtp.mail{ from = from, rcpt = rcpt, server = "wrong.host" } -if e ~= err then fail("wrong error message") +if ret or e ~= err then fail("wrong error message") else print("ok") end io.write("testing invalid from: ") -local err = socket.smtp.mail{ +local ret, err = socket.smtp.mail{ from = ' " " (( _ * ', rcpt = rcpt, } -if not err then fail("wrong error message") +if ret or not err then fail("wrong error message") else print(err) end io.write("testing no rcpt: ") -local err = socket.smtp.mail{ +local ret, err = socket.smtp.mail{ from = from, } -if not err then fail("wrong error message") +if ret or not err then fail("wrong error message") else print(err) end io.write("clearing mailbox: ") @@ -238,8 +238,8 @@ print("ok") io.write("sending messages: ") for i = 1, table.getn(sent) do - err = socket.smtp.mail(sent[i]) - if err then fail(err) end + ret, err = socket.smtp.mail(sent[i]) + if not ret then fail(err) end io.write("+") io.stdout:flush() end diff --git a/test/testclnt.lua b/test/testclnt.lua index b58ca2b..3f217bd 100644 --- a/test/testclnt.lua +++ b/test/testclnt.lua @@ -121,7 +121,7 @@ test_methods(socket.tcp(), { "getpeername", "getsockname", "setoption", - "timeout", + "settimeout", "close", }) @@ -135,7 +135,7 @@ test_methods(socket.udp(), { "receive", "receivefrom", "setoption", - "timeout", + "settimeout", "close", }) @@ -278,7 +278,7 @@ reconnect() -- the value is not important, we only want -- to test non-blockin I/O anyways -data:timeout(200) +data:settimeout(200) test_raw(1) test_raw(17) test_raw(200) @@ -298,7 +298,7 @@ function test_totaltimeoutreceive(len, tm, sl) reconnect() pass("%d bytes, %ds total timeout, %ds pause", len, tm, sl) remote (string.format ([[ - data:timeout(%d) + data:settimeout(%d) str = string.rep('a', %d) data:send(str) print('server: sleeping for %ds') @@ -306,7 +306,7 @@ function test_totaltimeoutreceive(len, tm, sl) print('server: woke up') data:send(str) ]], 2*tm, len, sl, sl)) - data:timeout(tm, "total") + data:settimeout(tm, "total") str, err, elapsed = data:receive(2*len) check_timeout(tm, sl, elapsed, err, "receive", "total", string.len(str) == 2*len) @@ -323,14 +323,14 @@ function test_totaltimeoutsend(len, tm, sl) reconnect() pass("%d bytes, %ds total timeout, %ds pause", len, tm, sl) remote (string.format ([[ - data:timeout(%d) + data:settimeout(%d) str = data:receive(%d) print('server: sleeping for %ds') socket.sleep(%d) print('server: woke up') str = data:receive(%d) ]], 2*tm, len, sl, sl, len)) - data:timeout(tm, "total") + data:settimeout(tm, "total") str = string.rep("a", 2*len) total, err, elapsed = data:send(str) check_timeout(tm, sl, elapsed, err, "send", "total", @@ -348,7 +348,7 @@ function test_blockingtimeoutreceive(len, tm, sl) reconnect() pass("%d bytes, %ds blocking timeout, %ds pause", len, tm, sl) remote (string.format ([[ - data:timeout(%d) + data:settimeout(%d) str = string.rep('a', %d) data:send(str) print('server: sleeping for %ds') @@ -356,7 +356,7 @@ function test_blockingtimeoutreceive(len, tm, sl) print('server: woke up') data:send(str) ]], 2*tm, len, sl, sl)) - data:timeout(tm) + data:settimeout(tm) str, err, elapsed = data:receive(2*len) check_timeout(tm, sl, elapsed, err, "receive", "blocking", string.len(str) == 2*len) @@ -373,14 +373,14 @@ function test_blockingtimeoutsend(len, tm, sl) reconnect() pass("%d bytes, %ds blocking timeout, %ds pause", len, tm, sl) remote (string.format ([[ - data:timeout(%d) + data:settimeout(%d) str = data:receive(%d) print('server: sleeping for %ds') socket.sleep(%d) print('server: woke up') str = data:receive(%d) ]], 2*tm, len, sl, sl, len)) - data:timeout(tm) + data:settimeout(tm) str = string.rep("a", 2*len) total, err, elapsed = data:send(str) check_timeout(tm, sl, elapsed, err, "send", "blocking", -- cgit v1.2.3-55-g6feb