summaryrefslogtreecommitdiff
path: root/test/drb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-30 09:36:41 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-30 09:36:41 +0000
commit1a8ccefafc490875a90515907f05a565c4c8f7ba (patch)
tree68dd6036eca5931bd9c70030d9df7bfbe1a1c6cd /test/drb
parentcf22db8d6910a428b2bb51b3c78c34b86d83bf74 (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@4865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/drb')
-rw-r--r--test/drb/test_drb.rb134
1 files changed, 70 insertions, 64 deletions
diff --git a/test/drb/test_drb.rb b/test/drb/test_drb.rb
index bd16e86..753ff09 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