Skip to content

Commit

Permalink
cue/load: add test coverage for loading a legacy cue.mod file
Browse files Browse the repository at this point in the history
https://cuelang.org/cl/1188428 explicitly dropped support for legacy
cue.mod files in favor of cue.mod/module.cue files.
However, we did not add a test case for the legacy edge case,
which should give the new human-friendly error.

Signed-off-by: Daniel Martí <[email protected]>
Change-Id: I067556498086ceba16c9a94ede22b47abb5aa8f9
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198064
Reviewed-by: Matthew Sackman <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
  • Loading branch information
mvdan committed Jul 19, 2024
1 parent f5b905c commit 28c6219
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cue/load/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,19 @@ root: $CWD/testdata/testmod
dir: $CWD/testdata/testmod/tagswithimports
display:.
files:
$CWD/testdata/testmod/tagswithimports/nonprod.cue`}}
$CWD/testdata/testmod/tagswithimports/nonprod.cue`}, {
name: "ModuleFileNonDirectory",
cfg: &Config{
Dir: testdata("testmod_legacymodfile"),
},
args: []string{"."},
want: `err: cue.mod files are no longer supported; use cue.mod/module.cue
path: ""
module: ""
root: ""
dir: ""
display:""`},
}
tdtest.Run(t, testCases, func(t *tdtest.T, tc *loadTest) {
pkgs := Instances(tc.args, tc.cfg)

Expand Down
1 change: 1 addition & 0 deletions cue/load/testdata/testmod_legacymodfile/cue.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module: "test.example/foo"
2 changes: 2 additions & 0 deletions cue/load/testdata/testmod_legacymodfile/foo.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package foo

0 comments on commit 28c6219

Please sign in to comment.