Skip to content

Commit 28c6219

Browse files
committed
cue/load: add test coverage for loading a legacy cue.mod file
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]>
1 parent f5b905c commit 28c6219

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

cue/load/loader_test.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,19 @@ root: $CWD/testdata/testmod
539539
dir: $CWD/testdata/testmod/tagswithimports
540540
display:.
541541
files:
542-
$CWD/testdata/testmod/tagswithimports/nonprod.cue`}}
542+
$CWD/testdata/testmod/tagswithimports/nonprod.cue`}, {
543+
name: "ModuleFileNonDirectory",
544+
cfg: &Config{
545+
Dir: testdata("testmod_legacymodfile"),
546+
},
547+
args: []string{"."},
548+
want: `err: cue.mod files are no longer supported; use cue.mod/module.cue
549+
path: ""
550+
module: ""
551+
root: ""
552+
dir: ""
553+
display:""`},
554+
}
543555
tdtest.Run(t, testCases, func(t *tdtest.T, tc *loadTest) {
544556
pkgs := Instances(tc.args, tc.cfg)
545557

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module: "test.example/foo"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package foo
2+

0 commit comments

Comments
 (0)