Found and fixed code deserialization bug.
This commit is contained in:
parent
bce01bbaa6
commit
c75bee763b
|
@ -87,7 +87,7 @@ class BSON
|
|||
while @buf.more?
|
||||
type = @buf.get
|
||||
case type
|
||||
when STRING
|
||||
when STRING, CODE
|
||||
key = deserialize_element_name(@buf)
|
||||
doc[key] = deserialize_string_data(@buf)
|
||||
when NUMBER
|
||||
|
|
|
@ -10,7 +10,13 @@ class BSONTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_object_encoding
|
||||
doc = {'doc' => {'age' => 41.2, 'name' => 'Spongebob'}}
|
||||
doc = {'doc' => {'age' => 42, 'name' => 'Spongebob', 'shoe_size' => 9.5}}
|
||||
@b.serialize(doc)
|
||||
assert_equal doc, @b.deserialize
|
||||
end
|
||||
|
||||
def test_code_encoding
|
||||
doc = {'$where' => 'this.a.b < this.b'}
|
||||
@b.serialize(doc)
|
||||
assert_equal doc, @b.deserialize
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue