aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-07-16 06:48:48 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-07-16 06:48:48 +0000
commite4e2223cff658a7016724a625ebbd3dacb92a8f9 (patch)
treeaac49c61149d30bf11219ab8d9989915bf7bee37 /test
parent9a79d500eb3e015f5bf579aab714916d49c1f289 (diff)
downloadluasocket-e4e2223cff658a7016724a625ebbd3dacb92a8f9.tar.gz
luasocket-e4e2223cff658a7016724a625ebbd3dacb92a8f9.tar.bz2
luasocket-e4e2223cff658a7016724a625ebbd3dacb92a8f9.zip
Fixed a bunch of stuff. Added mike's patches.
Diffstat (limited to 'test')
-rw-r--r--test/testclnt.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/testclnt.lua b/test/testclnt.lua
index a1fd805..f98a504 100644
--- a/test/testclnt.lua
+++ b/test/testclnt.lua
@@ -283,7 +283,9 @@ function empty_connect()
283 if not data then 283 if not data then
284 pass("ok") 284 pass("ok")
285 data = socket.connect(host, port) 285 data = socket.connect(host, port)
286 else fail("should not have connected!") end 286 else
287 pass("gethostbyname returns localhost on empty string...")
288 end
287end 289end
288 290
289------------------------------------------------------------------------ 291------------------------------------------------------------------------
@@ -374,19 +376,17 @@ end
374 376
375------------------------------------------------------------------------ 377------------------------------------------------------------------------
376function connect_timeout() 378function connect_timeout()
377 io.stderr:write("connect with timeout (if it hangs, it failed): ") 379 io.stderr:write("connect with timeout (if it hangs, it failed!): ")
378 local t = socket.gettime() 380 local t = socket.gettime()
379 local c, e = socket.tcp() 381 local c, e = socket.tcp()
380 assert(c, e) 382 assert(c, e)
381 c:settimeout(0.1) 383 c:settimeout(0.1)
382 ip = socket.dns.toip("ibere.tecgraf.puc-rio.br")
383 if not ip then return end
384 local t = socket.gettime() 384 local t = socket.gettime()
385 local r, e = c:connect(ip, 80) 385 local r, e = c:connect("127.0.0.2", 80)
386 assert(not r, "should not connect") 386 assert(not r, "should not connect")
387 --assert(e == "timeout", e)
388 assert(socket.gettime() - t < 2, "took too long to give up.") 387 assert(socket.gettime() - t < 2, "took too long to give up.")
389 c:close() 388 c:close()
389 print("ok")
390end 390end
391 391
392------------------------------------------------------------------------ 392------------------------------------------------------------------------