From a607c82efe3be64a1822ca70ebdcb45cfd5000d2 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 30 Oct 2003 09:36:41 +0000 Subject: * io.c (READ_DATA_BUFFERED): new macro to detect whether stdio buffer filled. * io.c (rb_io_fptr_cleanup): move path deallocation to rb_io_fptr_finalize (finalizer called by GC). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/drb/test_drb.rb | 134 +++++++++++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 64 deletions(-) (limited to 'test/drb') diff --git a/test/drb/test_drb.rb b/test/drb/test_drb.rb index bd16e8636..753ff0933 100644 --- a/test/drb/test_drb.rb +++ b/test/drb/test_drb.rb @@ -16,86 +16,92 @@ class TestDRbYield < Test::Unit::TestCase end def test_01_one - one = nil - @there.echo_yield_1([]) {|one|} - assert_equal([], one) + @there.echo_yield_1([]) {|one| + assert_equal([], one) + } - one = nil - @there.echo_yield_1(1) {|one|} - assert_equal(1, one) + @there.echo_yield_1(1) {|one| + assert_equal(1, one) + } - one = nil - @there.echo_yield_1(nil) {|one|} - assert_equal(nil, one) + @there.echo_yield_1(nil) {|one| + assert_equal(nil, one) + } end def test_02_two - one = two = nil - @there.echo_yield_2([], []) {|one, two|} - assert_equal([], one) - assert_equal([], two) - - one = two = nil - @there.echo_yield_2(1, 2) {|one, two|} - assert_equal(1, one) - assert_equal(2, two) - - one = two = nil - @there.echo_yield_2(3, nil) {|one, two|} - assert_equal(3, one) - assert_equal(nil, two) - - one = two = nil - @there.echo_yield_1([:key, :value]) {|one, two|} - assert_equal([:key, :value], one) - assert_equal(nil, two) + @there.echo_yield_2([], []) {|one, two| + assert_equal([], one) + assert_equal([], two) + } + + @there.echo_yield_2(1, 2) {|one, two| + assert_equal(1, one) + assert_equal(2, two) + } + + @there.echo_yield_2(3, nil) {|one, two| + assert_equal(3, one) + assert_equal(nil, two) + } + + @there.echo_yield_1([:key, :value]) {|one, two| + assert_equal(:key, one) + assert_equal(:value, two) + } end def test_03_many - s = nil - @there.echo_yield_0 {|*s|} - assert_equal([], s) - @there.echo_yield(nil) {|*s|} - assert_equal([nil], s) - @there.echo_yield(1) {|*s|} - assert_equal([1], s) - @there.echo_yield(1, 2) {|*s|} - assert_equal([1, 2], s) - @there.echo_yield(1, 2, 3) {|*s|} - assert_equal([1, 2, 3], s) - @there.echo_yield([], []) {|*s|} - assert_equal([[], []], s) - @there.echo_yield([]) {|*s|} - if RUBY_VERSION >= '1.8' + @there.echo_yield_0 {|*s| + assert_equal([], s) + } + @there.echo_yield(nil) {|*s| + assert_equal([nil], s) + } + @there.echo_yield(1) {|*s| + assert_equal([1], s) + } + @there.echo_yield(1, 2) {|*s| + assert_equal([1, 2], s) + } + @there.echo_yield(1, 2, 3) {|*s| + assert_equal([1, 2, 3], s) + } + @there.echo_yield([], []) {|*s| + assert_equal([[], []], s) + } + @there.echo_yield([]) {|*s| assert_equal([[]], s) # ! - else - assert_equal([], s) # ! - end + } end def test_04_many_to_one - s = nil - @there.echo_yield_0 {|*s|} - assert_equal([], s) - @there.echo_yield(nil) {|*s|} - assert_equal([nil], s) - @there.echo_yield(1) {|*s|} - assert_equal([1], s) - @there.echo_yield(1, 2) {|*s|} - assert_equal([1, 2], s) - @there.echo_yield(1, 2, 3) {|*s|} - assert_equal([1, 2, 3], s) - @there.echo_yield([], []) {|*s|} - assert_equal([[], []], s) - @there.echo_yield([]) {|*s|} - assert_equal([[]], s) + @there.echo_yield_0 {|*s| + assert_equal([], s) + } + @there.echo_yield(nil) {|*s| + assert_equal([nil], s) + } + @there.echo_yield(1) {|*s| + assert_equal([1], s) + } + @there.echo_yield(1, 2) {|*s| + assert_equal([1, 2], s) + } + @there.echo_yield(1, 2, 3) {|*s| + assert_equal([1, 2, 3], s) + } + @there.echo_yield([], []) {|*s| + assert_equal([[], []], s) + } + @there.echo_yield([]) {|*s| + assert_equal([[]], s) + } end def test_05_array_subclass @there.xarray_each {|x| assert_kind_of(XArray, x)} - if RUBY_VERSION >= '1.8' - @there.xarray_each {|*x| assert_kind_of(XArray, x[0])} - end + @there.xarray_each {|*x| assert_kind_of(XArray, x[0])} end end -- cgit