Fixed bug in BSON serializer: was forgetting to include NUL byt in string length.

This commit is contained in:
Jim Menard 2008-12-02 10:25:36 -05:00
parent 55f2e8d1b4
commit 4244f56ce6
2 changed files with 2 additions and 4 deletions

View File

@ -213,7 +213,7 @@ class BSON
end_pos = buf.position
# Put the string size in front
buf.put_int(end_pos - start_pos - 1, len_pos)
buf.put_int(end_pos - start_pos, len_pos)
# Go back to where we were
buf.position = end_pos

View File

@ -72,9 +72,7 @@ class DBAPITest < Test::Unit::TestCase
assert rows.length >= 1
row = rows.detect { |r| r['name'] == @coll_full_name }
assert_not_nil row
# FIXME restore this test when Mongo fixes this bug (or we prove I'm doing something wrong)
# Mongo bug: returns string with wrong length, so last byte of value is chopped off.
# assert_equal @coll.name, row['options']['create']
assert_equal @coll.name, row['options']['create']
end
def test_full_coll_name