Skip to content

Commit 7ceb629

Browse files
rogpeppemyitcv
authored andcommitted
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 <[email protected]> Change-Id: Ib1229a27c962315a51a66c87608d1022cde3b5e8 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1196179 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Daniel Martí <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1196233 Reviewed-by: Paul Jolly <[email protected]>
1 parent fc6d421 commit 7ceb629

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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"

cmd/cue/cmd/testdata/script/modtidy_initial.txtar

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ cmp stdout cue-cache-dir.files
1919
# Unused dependencies should not have their entire source downloaded or extracted.
2020
! stdout 'unused\.com.*\.zip$'
2121
-- want-module --
22-
module: "main.org@v0"
22+
module: "main.org"
2323
language: {
2424
version: "v0.8.0"
2525
}
@@ -47,10 +47,10 @@ deps: {
4747
"example.com@v0": "v0.0.1"
4848
}
4949
-- cue.mod/module.cue --
50-
module: "main.org@v0"
50+
module: "main.org"
5151
language: version: "v0.8.0"
5252

53-
deps: "example.com@v0": v: "v0.0.1"
53+
deps: "example.com": v: "v0.0.1"
5454
deps: "unused.com@v0": v: "v0.2.4"
5555

5656
-- main.cue --

0 commit comments

Comments
 (0)