Skip to content

Commit cc824fa

Browse files
committed
Corrects encoding test order.
1 parent 440373b commit cc824fa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bson/encode_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,7 @@ func reflectionEncoderTest(t *testing.T) {
740740
V _Interface
741741
W map[struct{}]struct{}
742742
X map[struct{}]struct{}
743+
Z time.Time
743744
}{
744745
A: true,
745746
B: 123,
@@ -768,6 +769,7 @@ func reflectionEncoderTest(t *testing.T) {
768769
V: _Interface((*_impl)(nil)), // typed nil
769770
W: map[struct{}]struct{}{},
770771
X: nil,
772+
Z: now,
771773
},
772774
docToBytes(NewDocument(
773775
EC.Boolean("a", true),
@@ -793,6 +795,7 @@ func reflectionEncoderTest(t *testing.T) {
793795
EC.Null("v"),
794796
EC.SubDocument("w", NewDocument()),
795797
EC.Null("x"),
798+
EC.DateTime("z", now.UnixNano()/int64(time.Millisecond)),
796799
)),
797800
nil,
798801
},
@@ -825,7 +828,7 @@ func reflectionEncoderTest(t *testing.T) {
825828
W []map[struct{}]struct{}
826829
X []map[struct{}]struct{}
827830
Y []map[struct{}]struct{}
828-
Z time.Time
831+
Z []time.Time
829832
}{
830833
A: []bool{true},
831834
B: []int32{123},
@@ -857,7 +860,7 @@ func reflectionEncoderTest(t *testing.T) {
857860
W: nil,
858861
X: []map[struct{}]struct{}{}, // Should be empty BSON Array
859862
Y: []map[struct{}]struct{}{{}}, // Should be BSON array with one element, an empty BSON SubDocument
860-
Z: now,
863+
Z: []time.Time{now, now},
861864
},
862865
docToBytes(NewDocument(
863866
EC.ArrayFromElements("a", VC.Boolean(true)),
@@ -884,7 +887,7 @@ func reflectionEncoderTest(t *testing.T) {
884887
EC.Null("w"),
885888
EC.Array("x", NewArray()),
886889
EC.ArrayFromElements("y", VC.Document(NewDocument())),
887-
EC.DateTime("z", now.UnixNano()/int64(time.Millisecond)),
890+
EC.ArrayFromElements("z", VC.DateTime(now.UnixNano()/int64(time.Millisecond)), VC.DateTime(now.UnixNano()/int64(time.Millisecond))),
888891
)),
889892
nil,
890893
},

0 commit comments

Comments
 (0)