summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/io/nonblock/test_flush.rb4
-rw-r--r--test/ruby/test_super.rb20
-rw-r--r--test/socket/test_tcp.rb11
3 files changed, 30 insertions, 5 deletions
diff --git a/test/io/nonblock/test_flush.rb b/test/io/nonblock/test_flush.rb
index 4f56d00829..40dbe94b3a 100644
--- a/test/io/nonblock/test_flush.rb
+++ b/test/io/nonblock/test_flush.rb
@@ -23,7 +23,7 @@ class TestIONonblock < Test::Unit::TestCase
end
}
assert_raise(IOError) {w.flush}
- t.join
- assert_equal("b", result)
+ assert_nothing_raised {t.join}
+ assert_equal(4097, result.size)
end
end if IO.method_defined?(:nonblock)
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb
index ec0f8b608e..16b623df61 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -65,4 +65,24 @@ class TestSuper < Test::Unit::TestCase
assert_equal([1,2,3], Array4.new.array(1, 2, 3))
assert_equal([1,2,3,4], Array4.new.array(1, 2, 3, 4))
end
+
+ class A
+ def tt(aa)
+ "A#tt"
+ end
+
+ def uu(a)
+ class << self
+ define_method(:tt) do |sym|
+ super
+ end
+ end
+ end
+ end
+
+ def test_define_method # [ruby-core:03856]
+ a = A.new
+ a.uu(12)
+ assert_raise(RuntimeError) {a.tt(12)}
+ end
end
diff --git a/test/socket/test_tcp.rb b/test/socket/test_tcp.rb
index e059621985..8d55c011cf 100644
--- a/test/socket/test_tcp.rb
+++ b/test/socket/test_tcp.rb
@@ -7,17 +7,22 @@ end
class TestTCPSocket < Test::Unit::TestCase
def test_recvfrom # [ruby-dev:24705]
+ c = s = nil
svr = TCPServer.new("localhost", 0)
Thread.new {
- svr.accept.print("x"*0x1000)
+ c = svr.accept
+ Thread.pass until s
+ c.print("x"*0x1000)
}
addr = svr.addr
sock = TCPSocket.open(addr[2], addr[1])
Thread.new {
- Thread.pass
+ Thread.pass until c
+ Thread.critical = true
ObjectSpace.each_object(String) {|s|
- s.replace "a" if s.length == 0x10000
+ s.replace "a" if s.length == 0x10000 and !s.frozen?
}
+ Thread.critical = false
}
assert_raise(RuntimeError, SocketError) {
sock.recvfrom(0x10000)