Skip to content

Commit 52d9689

Browse files
committed
cmd/cue: actually update the _gen.go.want gengotypes testscript files
We were doing `cmp foo.go foo.go` rather than `cmp foo.go foo.go.want`, which always succeeded, and caused CUE_UPDATE=1 to not update the "want" files at all. Fix that, and update the generated files to actually reflect what we do. This stumped and annoyed me enough that I also sent a change to testscript to make such silly mistakes an error: rogpeppe/go-internal#295 Signed-off-by: Daniel Martí <[email protected]> Change-Id: If24c6e2439a828c9da7cf3028c61126e899bd96c Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1213229 Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Roger Peppe <[email protected]>
1 parent 433ac2c commit 52d9689

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

Diff for: cmd/cue/cmd/testdata/script/exp_gengotypes.txtar

+13-7
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ stdout -count=5 'cue_types_.*gen\.go.want$'
1212
! stdout 'unused.*'${/@R}gen_go.cue
1313

1414
# Check the contents of the generated files.
15-
cmp root/cue_types_gen.go root/cue_types_gen.go
16-
cmp imported/subinst/cue_types_imported_gen.go imported/subinst/cue_types_imported_gen.go
17-
cmp imported/indirect/cue_types_gen.go imported/indirect/cue_types_gen.go
15+
cmp root/cue_types_gen.go root/cue_types_gen.go.want
16+
cmp imported/subinst/cue_types_imported_gen.go imported/subinst/cue_types_imported_gen.go.want
17+
cmp imported/indirect/cue_types_gen.go imported/indirect/cue_types_gen.go.want
1818
cmp imported/multipkg/cue_types_multipkg_one_gen.go imported/multipkg/cue_types_multipkg_one_gen.go.want
1919
cmp imported/multipkg/cue_types_multipkg_two_gen.go imported/multipkg/cue_types_multipkg_two_gen.go.want
2020

@@ -572,9 +572,9 @@ type RemoteStructs struct {
572572

573573
UpperDef imported.UpperDef `json:"UpperDef,omitempty"`
574574

575-
MultiOne multipkg_one.One `json:"multiOne,omitempty"`
575+
MultiOne multipkg.One `json:"multiOne,omitempty"`
576576

577-
MultiTwo multipkg_two.Two `json:"multiTwo,omitempty"`
577+
MultiTwo multipkg.Two `json:"multiTwo,omitempty"`
578578
}
579579

580580
type Types struct {
@@ -648,8 +648,6 @@ type Root struct {
648648

649649
Required int64 `json:"required,omitempty"`
650650

651-
QuotedField string `json:"quoted-field"`
652-
653651
// Optional types are represented as *T in Go if they are structs.
654652
Optional int64 `json:"optional,omitempty"`
655653

@@ -714,6 +712,8 @@ type Root struct {
714712
MustEqual1 int64 `json:"mustEqual1,omitempty"`
715713

716714
MustEqual2 any/* TODO: IncompleteKind: _|_ */ `json:"mustEqual2,omitempty"`
715+
716+
QuotedField string `json:"quoted-field,omitempty"`
717717
}
718718

719719
type EmbeddedStruct struct {
@@ -724,8 +724,14 @@ type EmbeddedStruct struct {
724724

725725
type AttrChangedName int64
726726

727+
type AttrChangedNameEmbed struct {
728+
Field int64 `json:"field,omitempty"`
729+
}
730+
727731
type AttrType constant.Kind
728732

733+
type AttrTypeEmbed constant.Kind
734+
729735
type Root_innerStruct struct {
730736
InnerStructField int64 `json:"innerStructField,omitempty"`
731737
}

0 commit comments

Comments
 (0)