test/lib_read_write.rb in kgio-1.1.0 vs test/lib_read_write.rb in kgio-1.2.0
- old
+ new
@@ -19,26 +19,44 @@
def test_read_eof
@wr.close
assert_nil @rd.kgio_read(5)
end
+ def test_read_bang_eof
+ @wr.close
+ begin
+ @rd.kgio_read!(5)
+ assert false, "should never get here (line:#{__LINE__})"
+ rescue EOFError => e
+ assert_equal [], e.backtrace
+ end
+ end
+
def test_tryread_eof
@wr.close
assert_nil @rd.kgio_tryread(5)
end
def test_write_closed
@rd.close
- assert_raises(Errno::EPIPE, Errno::ECONNRESET) {
+ begin
loop { @wr.kgio_write "HI" }
- }
+ rescue Errno::EPIPE, Errno::ECONNRESET => e
+ assert_equal [], e.backtrace
+ return
+ end
+ assert false, "should never get here (line:#{__LINE__})"
end
def test_trywrite_closed
@rd.close
- assert_raises(Errno::EPIPE, Errno::ECONNRESET) {
+ begin
loop { @wr.kgio_trywrite "HI" }
- }
+ rescue Errno::EPIPE, Errno::ECONNRESET => e
+ assert_equal [], e.backtrace
+ return
+ end
+ assert false, "should never get here (line:#{__LINE__})"
end
def test_write_conv
assert_equal nil, @wr.kgio_write(10)
assert_equal "10", @rd.kgio_read(2)