Skip to content

Commit

Permalink
internal/filetypes: fix TestParseFile tests
Browse files Browse the repository at this point in the history
These tests were disabled. Fix the error messages and reenable.

Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: Ibb399f3b9474cd5dd4f7043fa5638529aaf50c4e
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/542989
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
  • Loading branch information
rogpeppe committed Sep 2, 2022
1 parent d2250b9 commit 3290797
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions internal/filetypes/filetypes_test.go
Expand Up @@ -29,8 +29,8 @@ func check(t *testing.T, want, x interface{}, err error) {
if err != nil {
x = errors.String(err.(errors.Error))
}
if diff := cmp.Diff(x, want, cmpopts.EquateEmpty()); diff != "" {
t.Error(diff)
if diff := cmp.Diff(want, x, cmpopts.EquateEmpty()); diff != "" {
t.Errorf("unexpected result; -want +got\n%s", diff)
}
}

Expand Down Expand Up @@ -252,9 +252,7 @@ func TestFromFile(t *testing.T) {
}

func TestParseFile(t *testing.T) {
t.Skip("fix error messages")
// TODO(errors): wrong path?

testCases := []struct {
in string
mode Mode
Expand Down Expand Up @@ -311,10 +309,10 @@ func TestParseFile(t *testing.T) {
},
}, {
in: "foo:file.bar",
out: `cue: marshal error: tags: value "foo" not found`,
out: `unknown filetype foo`,
}, {
in: "file.bar",
out: `cue: marshal error: extensions: value ".bar" not found`,
out: `unknown file extension .bar`,
}}
for _, tc := range testCases {
t.Run(tc.in, func(t *testing.T) {
Expand Down

0 comments on commit 3290797

Please sign in to comment.