@@ -74,7 +74,7 @@ func TestNomsMarshalling(t *testing.T) {
7474 validated , err := validateUnmarshaledNomsValue (context .Background (), types .Format_7_18 , val )
7575
7676 if err != nil {
77- t .Fatal ("Failed compatibility test" )
77+ t .Fatal ("Failed compatibility test. Schema could not be unmarshalled with mirror type " )
7878 }
7979
8080 if ! reflect .DeepEqual (tSchema , validated ) {
@@ -186,9 +186,22 @@ func validateUnmarshaledNomsValue(ctx context.Context, nbf *types.NomsBinFormat,
186186 return sd .decodeSchema ()
187187}
188188
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+
189200// 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.
192205type testEncodedColumn struct {
193206 Tag uint64 `noms:"tag" json:"tag"`
194207
0 commit comments