1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
matz 2003-10-30 09:36:41 +00:00
parent cf22db8d69
commit 1a8ccefafc
6 changed files with 132 additions and 72 deletions

View file

@ -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)
@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)
@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)
@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_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