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