mirror of
https://github.com/ruby/ruby.git
synced 2025-08-27 15:06:10 +02:00
* array.c (rb_ary_reject_bang, rb_ary_delete_if): rejected
elements should be removed. fixed [Bug #2545] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a943788fb7
commit
e7047b8a37
3 changed files with 64 additions and 20 deletions
|
@ -607,6 +607,11 @@ class TestArray < Test::Unit::TestCase
|
|||
a = @cls[ 1, 2, 3, 4, 5 ]
|
||||
assert_equal(a, a.delete_if { |i| i > 3 })
|
||||
assert_equal(@cls[1, 2, 3], a)
|
||||
|
||||
bug2545 = '[ruby-core:27366]'
|
||||
a = @cls[ 5, 6, 7, 8, 9, 10 ]
|
||||
assert_equal(9, a.delete_if {|i| break i if i > 8; i < 7})
|
||||
assert_equal(@cls[7, 8], a, bug2545)
|
||||
end
|
||||
|
||||
def test_dup
|
||||
|
@ -1087,6 +1092,11 @@ class TestArray < Test::Unit::TestCase
|
|||
a = @cls[ 1, 2, 3, 4, 5 ]
|
||||
assert_equal(a, a.reject! { |i| i > 3 })
|
||||
assert_equal(@cls[1, 2, 3], a)
|
||||
|
||||
bug2545 = '[ruby-core:27366]'
|
||||
a = @cls[ 5, 6, 7, 8, 9, 10 ]
|
||||
assert_equal(9, a.reject! {|i| break i if i > 8; i < 7})
|
||||
assert_equal(@cls[7, 8], a, bug2545)
|
||||
end
|
||||
|
||||
def test_replace
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue