From 807a93be080e97dafb31f4d975b6eaa991070961 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 7 Dec 2004 18:26:12 +0000 Subject: [PATCH] * test/io/nonblock/test_flush.rb (TestIONonblock#test_flush): write operation ignores EAGAIN. * test/ruby/test_super.rb (TestSuper#test_define_method): test for super from proc. [ruby-core:03856] * test/socket/test_tcp.rb (TestTCPSocket#test_recvfrom): make execution order more precise. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/io/nonblock/test_flush.rb | 4 ++-- test/ruby/test_super.rb | 20 ++++++++++++++++++++ test/socket/test_tcp.rb | 11 ++++++++--- 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)