aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDiego Nehab <diego.nehab@gmail.com>2015-08-25 15:41:40 -0300
committerDiego Nehab <diego.nehab@gmail.com>2015-08-25 15:41:40 -0300
commit77bba625d7aaa0f9e118879163687fcbcb0b5a7b (patch)
treebbb719610c306b0af3225784164b44e2c509eb7c /test
parent96965b179c7311f850f72a8629b9ba6d3a31d117 (diff)
downloadluasocket-77bba625d7aaa0f9e118879163687fcbcb0b5a7b.tar.gz
luasocket-77bba625d7aaa0f9e118879163687fcbcb0b5a7b.tar.bz2
luasocket-77bba625d7aaa0f9e118879163687fcbcb0b5a7b.zip
Fixes suggested by @Florob in #147.
Diffstat (limited to 'test')
-rw-r--r--test/testclnt.lua19
1 files changed, 12 insertions, 7 deletions
diff --git a/test/testclnt.lua b/test/testclnt.lua
index abf9608..ee1201f 100644
--- a/test/testclnt.lua
+++ b/test/testclnt.lua
@@ -304,15 +304,20 @@ function isclosed(c)
304end 304end
305 305
306function active_close() 306function active_close()
307 reconnect() 307 local tcp = socket.tcp4()
308 if isclosed(data) then fail("should not be closed") end 308 if isclosed(tcp) then fail("should not be closed") end
309 data:close() 309 tcp:close()
310 if not isclosed(data) then fail("should be closed") end 310 if not isclosed(tcp) then fail("should be closed") end
311 data = nil 311 tcp = socket.tcp()
312 local udp = socket.udp() 312 if not isclosed(tcp) then fail("should be closed") end
313 tcp = nil
314 local udp = socket.udp4()
313 if isclosed(udp) then fail("should not be closed") end 315 if isclosed(udp) then fail("should not be closed") end
314 udp:close() 316 udp:close()
315 if not isclosed(udp) then fail("should be closed") end 317 if not isclosed(udp) then fail("should be closed") end
318 udp = socket.udp()
319 if not isclosed(udp) then fail("should be closed") end
320 udp = nil
316 pass("ok") 321 pass("ok")
317end 322end
318 323
@@ -368,7 +373,7 @@ function test_selectbugs()
368 pass("invalid input: ok") 373 pass("invalid input: ok")
369 local toomany = {} 374 local toomany = {}
370 for i = 1, socket._SETSIZE+1 do 375 for i = 1, socket._SETSIZE+1 do
371 toomany[#toomany+1] = socket.udp() 376 toomany[#toomany+1] = socket.udp4()
372 end 377 end
373 if #toomany > socket._SETSIZE then 378 if #toomany > socket._SETSIZE then
374 local e = pcall(socket.select, toomany, nil, 0.1) 379 local e = pcall(socket.select, toomany, nil, 0.1)