Skip to content

Commit f513a17

Browse files
committed
cue/load: add major version suffix to module path in testdata
We are about to enable the modules experiment by default, and its new module.cue schema requires a major version suffix in module paths. Signed-off-by: Roger Peppe <[email protected]> Change-Id: Ie1850a6acf2a7817fb7ec572c58850f23968d100 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1194790 Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent 0b70e5b commit f513a17

File tree

3 files changed

+53
-58
lines changed

3 files changed

+53
-58
lines changed

cue/load/example_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ func Example() {
8080

8181
// Output:
8282
// Number of instances: 1
83-
// Instance module: mod.test/test
84-
// Instance import path: mod.test/test/example
83+
// Instance module: mod.test/test@v0
84+
// Instance import path: mod.test/test/example@v0
8585
//
8686
// Source files:
8787
// example.cue with 3 declarations

cue/load/loader_test.go

Lines changed: 50 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -91,37 +91,37 @@ display:""`,
9191
// package of this directory.
9292
cfg: dirCfg,
9393
args: nil,
94-
want: `path: mod.test/test
95-
module: mod.test/test
94+
want: `err: import failed: cannot find package "mod.test/test/sub":
95+
$CWD/testdata/testmod/test.cue:3:8
96+
path: mod.test/test@v0
97+
module: mod.test/test@v0
9698
root: $CWD/testdata/testmod
9799
dir: $CWD/testdata/testmod
98100
display:.
99101
files:
100-
$CWD/testdata/testmod/test.cue
101-
imports:
102-
mod.test/test/sub: $CWD/testdata/testmod/sub/sub.cue`}, {
102+
$CWD/testdata/testmod/test.cue`}, {
103103
name: "DefaultPackageWithExplicitDotArgument",
104104
// Even though the directory is called testdata, the last path in
105105
// the module is test. So "package test" is correctly the default
106106
// package of this directory.
107107
cfg: dirCfg,
108108
args: []string{"."},
109-
want: `path: mod.test/test
110-
module: mod.test/test
109+
want: `err: import failed: cannot find package "mod.test/test/sub":
110+
$CWD/testdata/testmod/test.cue:3:8
111+
path: mod.test/test@v0
112+
module: mod.test/test@v0
111113
root: $CWD/testdata/testmod
112114
dir: $CWD/testdata/testmod
113115
display:.
114116
files:
115-
$CWD/testdata/testmod/test.cue
116-
imports:
117-
mod.test/test/sub: $CWD/testdata/testmod/sub/sub.cue`}, {
117+
$CWD/testdata/testmod/test.cue`}, {
118118
name: "RelativeImportPathWildcard",
119119
cfg: dirCfg,
120120
args: []string{"./other/..."},
121121
want: `err: import failed: relative import paths not allowed ("./file"):
122122
$CWD/testdata/testmod/other/main.cue:6:2
123123
path: ""
124-
module: mod.test/test
124+
module: mod.test/test@v0
125125
root: $CWD/testdata/testmod
126126
dir: ""
127127
display:""`}, {
@@ -130,8 +130,8 @@ display:""`}, {
130130
args: []string{"./anon"},
131131
want: `err: build constraints exclude all CUE files in ./anon:
132132
anon/anon.cue: no package name
133-
path: mod.test/test/anon
134-
module: mod.test/test
133+
path: mod.test/test/anon@v0
134+
module: mod.test/test@v0
135135
root: $CWD/testdata/testmod
136136
dir: $CWD/testdata/testmod/anon
137137
display:./anon`}, {
@@ -140,8 +140,8 @@ display:./anon`}, {
140140
args: []string{"./other"},
141141
want: `err: import failed: relative import paths not allowed ("./file"):
142142
$CWD/testdata/testmod/other/main.cue:6:2
143-
path: mod.test/test/other
144-
module: mod.test/test
143+
path: mod.test/test/other@v0:main
144+
module: mod.test/test@v0
145145
root: $CWD/testdata/testmod
146146
dir: $CWD/testdata/testmod/other
147147
display:./other
@@ -150,41 +150,36 @@ files:
150150
name: "RelativePathSuccess",
151151
cfg: dirCfg,
152152
args: []string{"./hello"},
153-
want: `path: mod.test/test/hello
154-
module: mod.test/test
153+
want: `err: import failed: cannot find package "mod.test/test/sub":
154+
$CWD/testdata/testmod/test.cue:3:8
155+
path: mod.test/test/hello@v0:test
156+
module: mod.test/test@v0
155157
root: $CWD/testdata/testmod
156158
dir: $CWD/testdata/testmod/hello
157159
display:./hello
158160
files:
159161
$CWD/testdata/testmod/test.cue
160-
$CWD/testdata/testmod/hello/test.cue
161-
imports:
162-
mod.test/test/sub: $CWD/testdata/testmod/sub/sub.cue`}, {
162+
$CWD/testdata/testmod/hello/test.cue`}, {
163163
name: "ExplicitPackageIdentifier",
164164
cfg: dirCfg,
165165
args: []string{"mod.test/test/hello:test"},
166-
want: `path: mod.test/test/hello:test
167-
module: mod.test/test
166+
want: `err: cannot find package "mod.test/test/hello:test"
167+
path: mod.test/test/hello:test
168+
module: mod.test/test@v0
168169
root: $CWD/testdata/testmod
169-
dir: $CWD/testdata/testmod/hello
170-
display:mod.test/test/hello:test
171-
files:
172-
$CWD/testdata/testmod/test.cue
173-
$CWD/testdata/testmod/hello/test.cue
174-
imports:
175-
mod.test/test/sub: $CWD/testdata/testmod/sub/sub.cue`}, {
170+
dir: $CWD/testdata/testmod/cue.mod/gen/mod.test/test/hello
171+
display:mod.test/test/hello:test`,
172+
}, {
176173
name: "NoPackageName",
177174
cfg: dirCfg,
178175
args: []string{"mod.test/test/hello:nonexist"},
179-
want: `err: build constraints exclude all CUE files in mod.test/test/hello:nonexist:
180-
anon.cue: no package name
181-
test.cue: package is test, want nonexist
182-
hello/test.cue: package is test, want nonexist
176+
want: `err: cannot find package "mod.test/test/hello:nonexist"
183177
path: mod.test/test/hello:nonexist
184-
module: mod.test/test
178+
module: mod.test/test@v0
185179
root: $CWD/testdata/testmod
186-
dir: $CWD/testdata/testmod/hello
187-
display:mod.test/test/hello:nonexist`}, {
180+
dir: $CWD/testdata/testmod/cue.mod/gen/mod.test/test/hello
181+
display:mod.test/test/hello:nonexist`,
182+
}, {
188183
name: "ExplicitNonPackageFiles",
189184
cfg: dirCfg,
190185
args: []string{"./anon.cue", "./other/anon.cue"},
@@ -222,7 +217,7 @@ files:
222217
args: []string{"foo.com/bad-identifier"},
223218
want: `err: implied package identifier "bad-identifier" from import path "foo.com/bad-identifier" is not valid
224219
path: foo.com/bad-identifier
225-
module: mod.test/test
220+
module: mod.test/test@v0
226221
root: $CWD/testdata/testmod
227222
dir: $CWD/testdata/testmod/cue.mod/gen/foo.com/bad-identifier
228223
display:foo.com/bad-identifier`,
@@ -232,7 +227,7 @@ display:foo.com/bad-identifier`,
232227
args: []string{"nonexisting"},
233228
want: `err: standard library import path "nonexisting" cannot be imported as a CUE package
234229
path: nonexisting
235-
module: mod.test/test
230+
module: mod.test/test@v0
236231
root: $CWD/testdata/testmod
237232
dir: ""
238233
display:nonexisting`,
@@ -242,7 +237,7 @@ display:nonexisting`,
242237
args: []string{"strconv"},
243238
want: `err: standard library import path "strconv" cannot be imported as a CUE package
244239
path: strconv
245-
module: mod.test/test
240+
module: mod.test/test@v0
246241
root: $CWD/testdata/testmod
247242
dir: ""
248243
display:strconv`,
@@ -251,17 +246,17 @@ display:strconv`,
251246
cfg: dirCfg,
252247
args: []string{"./empty"},
253248
want: `err: no CUE files in ./empty
254-
path: mod.test/test/empty
255-
module: mod.test/test
249+
path: mod.test/test/empty@v0
250+
module: mod.test/test@v0
256251
root: $CWD/testdata/testmod
257252
dir: $CWD/testdata/testmod/empty
258253
display:./empty`,
259254
}, {
260255
name: "PackageWithImports",
261256
cfg: dirCfg,
262257
args: []string{"./imports"},
263-
want: `path: mod.test/test/imports
264-
module: mod.test/test
258+
want: `path: mod.test/test/imports@v0
259+
module: mod.test/test@v0
265260
root: $CWD/testdata/testmod
266261
dir: $CWD/testdata/testmod/imports
267262
display:./imports
@@ -273,8 +268,8 @@ imports:
273268
name: "OnlyToolFiles",
274269
cfg: dirCfg,
275270
args: []string{"./toolonly"},
276-
want: `path: mod.test/test/toolonly
277-
module: mod.test/test
271+
want: `path: mod.test/test/toolonly@v0:foo
272+
module: mod.test/test@v0
278273
root: $CWD/testdata/testmod
279274
dir: $CWD/testdata/testmod/toolonly
280275
display:./toolonly
@@ -289,8 +284,8 @@ files:
289284
anon.cue: no package name
290285
test.cue: package is test, want foo
291286
toolonly/foo_tool.cue: _tool.cue files excluded in non-cmd mode
292-
path: mod.test/test/toolonly
293-
module: mod.test/test
287+
path: mod.test/test/toolonly@v0:foo
288+
module: mod.test/test@v0
294289
root: $CWD/testdata/testmod
295290
dir: $CWD/testdata/testmod/toolonly
296291
display:./toolonly`}, {
@@ -300,8 +295,8 @@ display:./toolonly`}, {
300295
Tags: []string{"prod"},
301296
},
302297
args: []string{"./tags"},
303-
want: `path: mod.test/test/tags
304-
module: mod.test/test
298+
want: `path: mod.test/test/tags@v0
299+
module: mod.test/test@v0
305300
root: $CWD/testdata/testmod
306301
dir: $CWD/testdata/testmod/tags
307302
display:./tags
@@ -313,8 +308,8 @@ files:
313308
Tags: []string{"prod", "foo=bar"},
314309
},
315310
args: []string{"./tags"},
316-
want: `path: mod.test/test/tags
317-
module: mod.test/test
311+
want: `path: mod.test/test/tags@v0
312+
module: mod.test/test@v0
318313
root: $CWD/testdata/testmod
319314
dir: $CWD/testdata/testmod/tags
320315
display:./tags
@@ -331,8 +326,8 @@ previous declaration here:
331326
$CWD/testdata/testmod/tagsbad/prod.cue:1:1
332327
multiple @if attributes:
333328
$CWD/testdata/testmod/tagsbad/prod.cue:2:1
334-
path: mod.test/test/tagsbad
335-
module: mod.test/test
329+
path: mod.test/test/tagsbad@v0
330+
module: mod.test/test@v0
336331
root: $CWD/testdata/testmod
337332
dir: $CWD/testdata/testmod/tagsbad
338333
display:./tagsbad`}, {
@@ -345,8 +340,8 @@ display:./tagsbad`}, {
345340
$CWD/testdata/testmod/cycle/cycle.cue:3:8
346341
$CWD/testdata/testmod/cue.mod/pkg/mod.test/cycle/bar/bar.cue:3:8
347342
$CWD/testdata/testmod/cue.mod/pkg/mod.test/cycle/foo/foo.cue:3:8
348-
path: mod.test/test/cycle
349-
module: mod.test/test
343+
path: mod.test/test/cycle@v0
344+
module: mod.test/test@v0
350345
root: $CWD/testdata/testmod
351346
dir: $CWD/testdata/testmod/cycle
352347
display:./cycle

cue/load/testdata/testmod/cue.mod/module.cue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
module: "mod.test/test"
15+
module: "mod.test/test@v0"
1616
language: version: "v0.8.0"

0 commit comments

Comments
 (0)