this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cmd/cue: add test for mod edit strictness

This CL adds a check for `cue mod edit` when
run on a module.cue file that is not acceptable to
strict checking, in preparation for a change
to make it work even with non-strict files.

It also changes the `cue mod tidy` check to ensure that
it adds major versions to dependency modules when
they are not present and that the major version is
not added when not already present. These are both
things that should probably have been tested here before
but were not.

Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: Ib1229a27c962315a51a66c87608d1022cde3b5e8
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1196179
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>

+15 -3
+12
cmd/cue/cmd/testdata/script/modedit_nonstrict.txtar
··· 1 + # This test checks that cue mod edit works OK even when the 2 + # module file doesn't conform to the strict parsing. 3 + # TODO fix this to pass. 4 + ! exec cue mod edit --source self 5 + cmpenv stderr want-stderr 6 + 7 + -- cue.mod/module.cue -- 8 + module: "main.org" 9 + deps: "foo.com": v: "v1.2.3" 10 + language: version: "v0.9.0-alpha.0" 11 + -- want-stderr -- 12 + invalid module.cue file $WORK${/}cue.mod${/}module.cue: no major version in "foo.com"
+3 -3
cmd/cue/cmd/testdata/script/modtidy_initial.txtar
··· 19 19 # Unused dependencies should not have their entire source downloaded or extracted. 20 20 ! stdout 'unused\.com.*\.zip$' 21 21 -- want-module -- 22 - module: "main.org@v0" 22 + module: "main.org" 23 23 language: { 24 24 version: "v0.8.0" 25 25 } ··· 47 47 "example.com@v0": "v0.0.1" 48 48 } 49 49 -- cue.mod/module.cue -- 50 - module: "main.org@v0" 50 + module: "main.org" 51 51 language: version: "v0.8.0" 52 52 53 - deps: "example.com@v0": v: "v0.0.1" 53 + deps: "example.com": v: "v0.0.1" 54 54 deps: "unused.com@v0": v: "v0.2.4" 55 55 56 56 -- main.cue --