Skip to content

Commit c237083

Browse files
committed
mod/modpkgload: capture faulty behaviour of pkg.fromExternal
Modify test to capture the faulty behaviour. Signed-off-by: Matthew Sackman <[email protected]> Change-Id: Ie4961f29a990c7dff13d92ee1763ac5302ac6041 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1217736 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Roger Peppe <[email protected]>
1 parent 703c22c commit c237083

9 files changed

+20
-0
lines changed

internal/mod/modpkgload/pkgload_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func TestLoadPackages(t *testing.T) {
7777
printf("\tmissing: %v\n", errors.As(pkg.Error(), new(*ImportMissingError)))
7878
} else {
7979
printf("\tmod: %v\n", pkg.Mod())
80+
printf("\texternal: %v\n", pkg.FromExternalModule())
8081
// Sanity check that the module file is available at pkg.ModRoot.
8182
_, err := fs.Stat(pkg.ModRoot().FS, path.Join(pkg.ModRoot().Dir, "cue.mod/module.cue"))
8283
qt.Assert(t, qt.IsNil(err), qt.Commentf("pkg %q; mod root: %#v", pkg.ImportPath(), pkg.ModRoot()))

internal/mod/modpkgload/testdata/localpackage.txtar

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ main.test@v0:main
77
main.test@v0:main
88
flags: inAll,isRoot,fromRoot,importsLoaded
99
mod: main.test@v0
10+
external: true
1011
location: .
1112
imports:
1213
other.com/blah
1314
other.com/blah
1415
flags: inAll,isRoot,fromRoot,importsLoaded
1516
mod: local
17+
external: true
1618
location: cue.mod/gen/other.com/blah
1719
-- main.cue --
1820
package main

internal/mod/modpkgload/testdata/localpackageambiguous.txtar

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ main.test@v0:main
1515
main.test@v0:main
1616
flags: inAll,isRoot,fromRoot,importsLoaded
1717
mod: main.test@v0
18+
external: true
1819
location: .
1920
imports:
2021
example.com/blah
2122
example.com/blah
2223
flags: inAll,isRoot,fromRoot,importsLoaded
2324
mod: local
25+
external: true
2426
location: cue.mod/gen/example.com/blah
2527
-- test1/initial-requirements --
2628
main.test@v0
@@ -32,6 +34,7 @@ main.test@v0:main
3234
main.test@v0:main
3335
flags: inAll,isRoot,fromRoot,importsLoaded
3436
mod: main.test@v0
37+
external: true
3538
location: .
3639
imports:
3740
example.com/blah

internal/mod/modpkgload/testdata/localpackagemultipledirs.txtar

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ main.test@v0:main
77
main.test@v0:main
88
flags: inAll,isRoot,fromRoot,importsLoaded
99
mod: main.test@v0
10+
external: true
1011
location: .
1112
imports:
1213
other.com/blah
1314
other.com/blah
1415
flags: inAll,isRoot,fromRoot,importsLoaded
1516
mod: local
17+
external: true
1618
location: cue.mod/gen/other.com/blah
1719
location: cue.mod/usr/other.com/blah
1820
location: cue.mod/pkg/other.com/blah

internal/mod/modpkgload/testdata/multidir.txtar

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ main.test@v0:main
88
main.test@v0:main
99
flags: inAll,isRoot,fromRoot,importsLoaded
1010
mod: main.test@v0
11+
external: true
1112
location: .
1213
imports:
1314
example.com/blah@v0
1415
example.com/blah@v0
1516
flags: inAll,isRoot,fromRoot,importsLoaded
1617
18+
external: true
1719
location: _registry/example.com_v0.0.1/blah
1820
imports:
1921
foo.com/bar/hello/goodbye@v0

internal/mod/modpkgload/testdata/nocuefiles.txtar

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ main.test@v0:main
88
main.test@v0:main
99
flags: inAll,isRoot,fromRoot,importsLoaded
1010
mod: main.test@v0
11+
external: true
1112
location: .
1213
imports:
1314
example.com/blah@v0

internal/mod/modpkgload/testdata/packagegranularity.txtar

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ main.test@v0:main
1010
main.test@v0:main
1111
flags: inAll,isRoot,fromRoot,importsLoaded
1212
mod: main.test@v0
13+
external: true
1314
location: .
1415
imports:
1516
example.com/blah@v0
@@ -28,18 +29,21 @@ main.test@v0:main
2829
main.test@v0:main
2930
flags: inAll,isRoot,fromRoot,importsLoaded
3031
mod: main.test@v0
32+
external: true
3133
location: .
3234
imports:
3335
example.com/blah@v0
3436
example.com/blah@v0
3537
flags: inAll,isRoot,fromRoot,importsLoaded
3638
39+
external: true
3740
location: _registry/example.com_v0.0.1/blah
3841
imports:
3942
foo.com/bar/hello/goodbye@v0
4043
foo.com/bar/hello/goodbye@v0
4144
flags: inAll,isRoot,fromRoot,importsLoaded
4245
mod: foo.com/[email protected]
46+
external: true
4347
location: _registry/foo.com_bar_v0.0.1/hello/goodbye
4448
-- main.cue --
4549
package main

internal/mod/modpkgload/testdata/simple.txtar

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ main.test@v0:main
77
main.test@v0:main
88
flags: inAll,isRoot,fromRoot,importsLoaded
99
mod: main.test@v0
10+
external: true
1011
location: .
1112
imports:
1213
example.com/blah@v0
@@ -24,12 +25,14 @@ main.test@v0:main
2425
main.test@v0:main
2526
flags: inAll,isRoot,fromRoot,importsLoaded
2627
mod: main.test@v0
28+
external: true
2729
location: .
2830
imports:
2931
example.com/blah@v0
3032
example.com/blah@v0
3133
flags: inAll,isRoot,fromRoot,importsLoaded
3234
35+
external: true
3336
location: _registry/example.com_v0.0.1/blah
3437
imports:
3538
foo.com/bar/hello/goodbye@v0

internal/mod/modpkgload/testdata/withdefaultmajorversions.txtar

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ example.com@v0
99
main.test@v0:main
1010
flags: inAll,isRoot,fromRoot,importsLoaded
1111
mod: main.test@v0
12+
external: true
1213
location: .
1314
imports:
1415
example.com/blah
1516
example.com/blah
1617
flags: inAll,isRoot,fromRoot,importsLoaded
1718
19+
external: true
1820
location: _registry/example.com_v0.0.1/blah
1921
imports:
2022
foo.com/bar/hello/goodbye@v0

0 commit comments

Comments
 (0)