diff options
Diffstat (limited to 'src/mongo/gotools/vendor/src/gopkg.in/mgo.v2/bson/bson_test.go')
-rw-r--r-- | src/mongo/gotools/vendor/src/gopkg.in/mgo.v2/bson/bson_test.go | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/src/mongo/gotools/vendor/src/gopkg.in/mgo.v2/bson/bson_test.go b/src/mongo/gotools/vendor/src/gopkg.in/mgo.v2/bson/bson_test.go index 37451f9fdc2..11fdfae4185 100644 --- a/src/mongo/gotools/vendor/src/gopkg.in/mgo.v2/bson/bson_test.go +++ b/src/mongo/gotools/vendor/src/gopkg.in/mgo.v2/bson/bson_test.go @@ -29,19 +29,16 @@ package bson_test import ( "encoding/binary" - "encoding/hex" "encoding/json" "encoding/xml" "errors" "net/url" "reflect" - "strings" "testing" "time" . "gopkg.in/check.v1" "gopkg.in/mgo.v2/bson" - "gopkg.in/yaml.v2" ) func TestAll(t *testing.T) { @@ -1581,65 +1578,6 @@ func (s *S) TestObjectIdJSONMarshaling(c *C) { } // -------------------------------------------------------------------------- -// Spec tests - -type specTest struct { - Description string - Documents []struct { - Decoded map[string]interface{} - Encoded string - DecodeOnly bool `yaml:"decodeOnly"` - Error interface{} - } -} - -func (s *S) TestSpecTests(c *C) { - for _, data := range specTests { - var test specTest - err := yaml.Unmarshal([]byte(data), &test) - c.Assert(err, IsNil) - - c.Logf("Running spec test set %q", test.Description) - - for _, doc := range test.Documents { - if doc.Error != nil { - continue - } - c.Logf("Ensuring %q decodes as %v", doc.Encoded, doc.Decoded) - var decoded map[string]interface{} - encoded, err := hex.DecodeString(doc.Encoded) - c.Assert(err, IsNil) - err = bson.Unmarshal(encoded, &decoded) - c.Assert(err, IsNil) - c.Assert(decoded, DeepEquals, doc.Decoded) - } - - for _, doc := range test.Documents { - if doc.DecodeOnly || doc.Error != nil { - continue - } - c.Logf("Ensuring %v encodes as %q", doc.Decoded, doc.Encoded) - encoded, err := bson.Marshal(doc.Decoded) - c.Assert(err, IsNil) - c.Assert(strings.ToUpper(hex.EncodeToString(encoded)), Equals, doc.Encoded) - } - - for _, doc := range test.Documents { - if doc.Error == nil { - continue - } - c.Logf("Ensuring %q errors when decoded: %s", doc.Encoded, doc.Error) - var decoded map[string]interface{} - encoded, err := hex.DecodeString(doc.Encoded) - c.Assert(err, IsNil) - err = bson.Unmarshal(encoded, &decoded) - c.Assert(err, NotNil) - c.Logf("Failed with: %v", err) - } - } -} - -// -------------------------------------------------------------------------- // ObjectId Text encoding.TextUnmarshaler. var textIdTests = []struct { |