Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/mod/modload: support adding language version
We want to add a language version declaration to the module.cue file when it's not present. This enables that. Also change the modload tests to use `modfile.File.Format` to format their output, as that's more representative of the actual use. Signed-off-by: Roger Peppe <rogpeppe@gmail.com> Change-Id: I627d2522d6bf7a88a90c9031058addd7b8d5758d Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1173894 TryBot-Result: CUEcueckoo <cueckoo@cuelang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
- Loading branch information
Showing
11 changed files
with
75 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Test that a version is added if not present | ||
-- cue-version -- | ||
v1.2.3 | ||
-- want -- | ||
module: "main.org@v0" | ||
language: { | ||
version: "v1.2.3" | ||
} | ||
-- cue.mod/module.cue -- | ||
module: "main.org@v0" | ||
-- main.cue -- | ||
package main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 5 additions & 7 deletions
12
internal/mod/modload/testdata/implied-major-version-with-explicit-default.txtar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 5 additions & 7 deletions
12
internal/mod/modload/testdata/implied-major-version-without-explicit-default.txtar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Test that a version is not added if present | ||
-- cue-version -- | ||
v1.2.3 | ||
-- want -- | ||
module: "main.org@v0" | ||
language: { | ||
version: "v1.0.3" | ||
} | ||
-- cue.mod/module.cue -- | ||
module: "main.org@v0" | ||
language: version: "v1.0.3" | ||
-- main.cue -- | ||
package main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters