diff options
author | Eric Wong <e@yhbt.net> | 2010-09-27 00:24:50 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2010-09-27 00:31:56 +0000 |
commit | 87cf3ce6185b9138032a5af53cecae98f8c93564 (patch) | |
tree | a6c2290df504027fa9d72ddd3eec6a4450bf9929 /test | |
parent | 6fbde1518578dd1b828efcecaf2caf893bddc110 (diff) | |
download | kgio-87cf3ce6185b9138032a5af53cecae98f8c93564.tar.gz |
We cannot raise exceptions and expect GC to clean up after us until we've created an actual IO object.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_connect_fd_leak.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test_connect_fd_leak.rb b/test/test_connect_fd_leak.rb new file mode 100644 index 0000000..5889e3a --- /dev/null +++ b/test/test_connect_fd_leak.rb @@ -0,0 +1,23 @@ +require 'test/unit' +require 'io/nonblock' +$-w = true +require 'kgio' + +class TestConnectFDLeak < Test::Unit::TestCase + + def teardown + Kgio.wait_readable = Kgio.wait_writable = nil + end + + def test_unix_socket + nr = 0 + path = "/non/existent/path" + assert(! File.exist?(path), "#{path} should not exist") + assert_nothing_raised do + begin + sock = Kgio::UNIXSocket.new(path) + rescue Errno::ENOENT + end while (nr += 1) < 10000 + end + end +end |