RUBY-172 fix for OrderedHash#clone
This commit is contained in:
parent
a167bfb71b
commit
2eaca6bc8e
|
@ -88,7 +88,7 @@ module BSON
|
|||
@ordered_keys ||= []
|
||||
@ordered_keys.map { |k| [k, self[k]] }
|
||||
end
|
||||
|
||||
|
||||
def values
|
||||
collect { |k, v| v }
|
||||
end
|
||||
|
@ -158,6 +158,9 @@ module BSON
|
|||
end
|
||||
end
|
||||
|
||||
def clone
|
||||
Marshal::load(Marshal.dump(self))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -187,4 +187,11 @@ class OrderedHashTest < Test::Unit::TestCase
|
|||
assert !new.keys.include?('z')
|
||||
end
|
||||
|
||||
def test_clone
|
||||
copy = @oh.clone
|
||||
assert copy.keys == @oh.keys
|
||||
|
||||
copy[:foo] = 1
|
||||
assert copy.keys != @oh.keys
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue