@@ -74,7 +74,7 @@ func TestNomsMarshalling(t *testing.T) {
74
74
validated , err := validateUnmarshaledNomsValue (context .Background (), types .Format_7_18 , val )
75
75
76
76
if err != nil {
77
- t .Fatal ("Failed compatibility test" )
77
+ t .Fatal ("Failed compatibility test. Schema could not be unmarshalled with mirror type " )
78
78
}
79
79
80
80
if ! reflect .DeepEqual (tSchema , validated ) {
@@ -186,9 +186,22 @@ func validateUnmarshaledNomsValue(ctx context.Context, nbf *types.NomsBinFormat,
186
186
return sd .decodeSchema ()
187
187
}
188
188
189
+ func TestMirroredTypes (t * testing.T ) {
190
+ realType := reflect .ValueOf (& encodedColumn {}).Elem ()
191
+ mirrorType := reflect .ValueOf (& testEncodedColumn {}).Elem ()
192
+ require .Equal (t , mirrorType .NumField (), realType .NumField ())
193
+
194
+ // TODO: create reflection tests to ensure that:
195
+ // - no fields in testEncodeColumn have the 'omitempty' annotation
196
+ // - no legacy fields in encodeColumn have the 'omitempty' annotation (with whitelist)
197
+ // - all new fields in encodeColumn have the 'omitempty' annotation
198
+ }
199
+
189
200
// testEncodedColumn is a mirror type of encodedColumn that helps ensure compatibility between Dolt versions
190
- // fields in this test struct should be added WITHOUT the "omitempty" annotation in order to guarentee that
191
- // all fields are being always being written when encodedColumn is serialized.
201
+ //
202
+ // Fields in this test struct should be added WITHOUT the "omitempty" annotation in order to guarantee that
203
+ // all fields in encodeColumn are always being written when encodedColumn is serialized.
204
+ // See the comment above type encodeColumn.
192
205
type testEncodedColumn struct {
193
206
Tag uint64 `noms:"tag" json:"tag"`
194
207
0 commit comments