diff options
author | alabid <alabidan@gmail.com> | 2014-10-21 15:13:32 -0400 |
---|---|---|
committer | alabid <alabidan@gmail.com> | 2014-10-21 15:13:32 -0400 |
commit | 0adbbbc2ac8e63fdb0916f776f3cdaea4c59dd02 (patch) | |
tree | 45a24096a2f37abbcfa18b0c67b62092096214cb /common | |
parent | b70bf86efdcd92b6f53042ed255547eb1d57a043 (diff) | |
download | mongo-0adbbbc2ac8e63fdb0916f776f3cdaea4c59dd02.tar.gz |
add unit test type to converter_test.go
Former-commit-id: 04d79c20dcf607f16fe380111398113826dee791
Diffstat (limited to 'common')
-rw-r--r-- | common/bsonutil/converter_test.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/common/bsonutil/converter_test.go b/common/bsonutil/converter_test.go index 7d789bf38d8..972b39db35f 100644 --- a/common/bsonutil/converter_test.go +++ b/common/bsonutil/converter_test.go @@ -4,6 +4,7 @@ import ( "encoding/base64" "fmt" "github.com/mongodb/mongo-tools/common/json" + "github.com/mongodb/mongo-tools/common/testutil" . "github.com/smartystreets/goconvey/convey" "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" @@ -12,6 +13,8 @@ import ( ) func TestObjectIdBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting a BSON ObjectId", t, func() { Convey("that is valid to JSON should produce a json.ObjectId", func() { bsonObjId := bson.NewObjectId() @@ -29,6 +32,8 @@ func TestObjectIdBSONToJSON(t *testing.T) { } func TestArraysBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting BSON arrays to JSON arrays", t, func() { Convey("should work for empty arrays", func() { jArr, err := ConvertBSONValueToJSON([]interface{}{}) @@ -74,6 +79,7 @@ func TestArraysBSONToJSON(t *testing.T) { } func TestDateBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) timeNow := time.Now() secs := int64(timeNow.Unix()) @@ -117,6 +123,8 @@ func TestDateBSONToJSON(t *testing.T) { } func TestMaxKeyBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting a BSON Maxkey to JSON", t, func() { Convey("should produce a json.MaxKey", func() { _jObj, err := ConvertBSONValueToJSON(bson.MaxKey) @@ -130,6 +138,8 @@ func TestMaxKeyBSONToJSON(t *testing.T) { } func TestMinKeyBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting a BSON Maxkey to JSON", t, func() { Convey("should produce a json.MinKey", func() { _jObj, err := ConvertBSONValueToJSON(bson.MinKey) @@ -143,6 +153,8 @@ func TestMinKeyBSONToJSON(t *testing.T) { } func Test64BitIntBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting a BSON int64 to JSON", t, func() { Convey("should produce a json.NumberLong", func() { _jObj, err := ConvertBSONValueToJSON(int32(243)) @@ -157,6 +169,8 @@ func Test64BitIntBSONToJSON(t *testing.T) { } func Test32BitIntBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting a BSON int32 integer to JSON", t, func() { Convey("should produce a json.NumberInt", func() { _jObj, err := ConvertBSONValueToJSON(int64(888234334343)) @@ -171,6 +185,8 @@ func Test32BitIntBSONToJSON(t *testing.T) { } func TestRegExBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting a BSON Regular Expression (= /decision/gi) to JSON", t, func() { Convey("should produce a json.RegExp", func() { _jObj, err := ConvertBSONValueToJSON(bson.RegEx{"decision", "gi"}) @@ -185,6 +201,8 @@ func TestRegExBSONToJSON(t *testing.T) { } func TestUndefinedValueBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting a BSON Undefined type to JSON", t, func() { Convey("should produce a json.Undefined", func() { _jObj, err := ConvertBSONValueToJSON(bson.Undefined) @@ -198,6 +216,8 @@ func TestUndefinedValueBSONToJSON(t *testing.T) { } func TestDBRefBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting BSON DBRef to JSON", t, func() { Convey("should produce a json.DBRef", func() { _jObj, err := ConvertBSONValueToJSON(mgo.DBRef{"coll1", "some_id", "test"}) @@ -212,6 +232,8 @@ func TestDBRefBSONToJSON(t *testing.T) { } func TestTimestampBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting a BSON Timestamp to JSON", t, func() { Convey("should produce a json.Timestamp", func() { // {t:803434343, i:9} == bson.MongoTimestamp(803434343*2**32 + 9) @@ -227,6 +249,8 @@ func TestTimestampBSONToJSON(t *testing.T) { } func TestBinaryBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting BSON Binary data to JSON", t, func() { Convey("should produce a json.BinData", func() { _jObj, err := ConvertBSONValueToJSON(bson.Binary{'\x01', []byte("\x05\x20\x02\xae\xf7")}) @@ -243,6 +267,8 @@ func TestBinaryBSONToJSON(t *testing.T) { } func TestGenericBytesBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting Go bytes to JSON", t, func() { Convey("should produce a json.BinData with Type=0x00 (Generic)", func() { _jObj, err := ConvertBSONValueToJSON([]byte("this is something that's cool")) @@ -258,6 +284,8 @@ func TestGenericBytesBSONToJSON(t *testing.T) { } func TestUnknownBSONTypeToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting an unknown BSON type to JSON", t, func() { Convey("should produce an error", func() { _, err := ConvertBSONValueToJSON(func() {}) @@ -267,6 +295,8 @@ func TestUnknownBSONTypeToJSON(t *testing.T) { } func TestDBPointerBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting BSON DBPointer to JSON", t, func() { Convey("should produce a json.DBPointer", func() { objId := bson.NewObjectId() @@ -281,6 +311,8 @@ func TestDBPointerBSONToJSON(t *testing.T) { } func TestJSCodeBSONToJSON(t *testing.T) { + testutil.VerifyTestType(t, testutil.UNIT_TEST_TYPE) + Convey("Converting BSON Javascript code to JSON", t, func() { Convey("should produce a json.Javascript", func() { Convey("without scope if the scope for the BSON Javascript code is nil", func() { |