diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-21 18:40:52 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-21 18:40:52 +0000 |
commit | 195069cf5f929f445b0ce20e531cd482d2559083 (patch) | |
tree | 6444d37c4ce32395428ba26ee0d16c0c372bd9da /test/testclnt.lua | |
parent | e63f500d24ff0238425c9e13f220daf09a277ef5 (diff) | |
download | luasocket-195069cf5f929f445b0ce20e531cd482d2559083.tar.gz luasocket-195069cf5f929f445b0ce20e531cd482d2559083.tar.bz2 luasocket-195069cf5f929f445b0ce20e531cd482d2559083.zip |
Fixed functions that return messages in ?socket.c.
Moved complexity of connect and accept there.
Created a new options.c module to take care of options.
Auxiliar.c is now cleaner.
Diffstat (limited to 'test/testclnt.lua')
-rw-r--r-- | test/testclnt.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/testclnt.lua b/test/testclnt.lua index 5a001b3..a0d9fda 100644 --- a/test/testclnt.lua +++ b/test/testclnt.lua | |||
@@ -379,6 +379,19 @@ function connect_timeout() | |||
379 | end | 379 | end |
380 | 380 | ||
381 | ------------------------------------------------------------------------ | 381 | ------------------------------------------------------------------------ |
382 | function rebind_test() | ||
383 | local c = socket.bind("localhost", 0) | ||
384 | local i, p = c:getsockname() | ||
385 | local s, e = socket.tcp() | ||
386 | assert(s, e) | ||
387 | s:setoption("reuseaddr", false) | ||
388 | r, e = s:bind("localhost", p) | ||
389 | assert(not r, "managed to rebind!") | ||
390 | assert(e == "address already in use") | ||
391 | print("ok") | ||
392 | end | ||
393 | |||
394 | ------------------------------------------------------------------------ | ||
382 | test("method registration") | 395 | test("method registration") |
383 | test_methods(socket.tcp(), { | 396 | test_methods(socket.tcp(), { |
384 | "connect", | 397 | "connect", |
@@ -416,6 +429,9 @@ test_selectbugs() | |||
416 | test("empty host connect: ") | 429 | test("empty host connect: ") |
417 | empty_connect() | 430 | empty_connect() |
418 | 431 | ||
432 | test("rebinding: ") | ||
433 | rebind_test() | ||
434 | |||
419 | test("active close: ") | 435 | test("active close: ") |
420 | active_close() | 436 | active_close() |
421 | 437 | ||