summaryrefslogtreecommitdiff
path: root/test/drb/test_drb.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/drb/test_drb.rb')
-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 bd16e86368..753ff09335 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