RUBY-265 fix OrderedHash#reject!
This commit is contained in:
parent
9c30de332f
commit
d0a4483713
|
@ -138,6 +138,10 @@ module BSON
|
||||||
clone.delete_if(&block)
|
clone.delete_if(&block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def reject!(&block)
|
||||||
|
delete_if(&block)
|
||||||
|
end
|
||||||
|
|
||||||
def clear
|
def clear
|
||||||
super
|
super
|
||||||
@ordered_keys = []
|
@ordered_keys = []
|
||||||
|
|
|
@ -187,6 +187,11 @@ class OrderedHashTest < Test::Unit::TestCase
|
||||||
assert !new.keys.include?('z')
|
assert !new.keys.include?('z')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_reject_bang
|
||||||
|
@oh.reject! { |k, v| k == 'z' }
|
||||||
|
assert !@ok.keys.include?('z')
|
||||||
|
end
|
||||||
|
|
||||||
def test_clone
|
def test_clone
|
||||||
copy = @oh.clone
|
copy = @oh.clone
|
||||||
assert copy.keys == @oh.keys
|
assert copy.keys == @oh.keys
|
||||||
|
@ -194,7 +199,7 @@ class OrderedHashTest < Test::Unit::TestCase
|
||||||
copy[:foo] = 1
|
copy[:foo] = 1
|
||||||
assert copy.keys != @oh.keys
|
assert copy.keys != @oh.keys
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_dup
|
def test_dup
|
||||||
oh2 = @oh.dup
|
oh2 = @oh.dup
|
||||||
oh2['f'] = 9
|
oh2['f'] = 9
|
||||||
|
|
Loading…
Reference in New Issue