RUBY-172 fix for OrderedHash#clone

This commit is contained in:
Kyle Banker 2010-08-27 15:50:42 -04:00
parent a167bfb71b
commit 2eaca6bc8e
2 changed files with 11 additions and 1 deletions

View File

@ -158,6 +158,9 @@ module BSON
end
end
def clone
Marshal::load(Marshal.dump(self))
end
end
end
end

View File

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