Skip to content

Commit

Permalink
cmd/cue: add failing tests for 'cue get go' transitive deps regression
Browse files Browse the repository at this point in the history
The following patch will include the fix and change these tests
so that they expect to succeed.

For #3033.

Signed-off-by: Daniel Martí <[email protected]>
Change-Id: I0e5bb77e79a0bd1c339d73c9cf2950630f834672
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1193698
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Roger Peppe <[email protected]>
  • Loading branch information
mvdan committed Apr 23, 2024
1 parent 3a90b84 commit 81f5a20
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
31 changes: 31 additions & 0 deletions cmd/cue/cmd/testdata/mod/externalmod.test_imports_v1.0.0.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-- .mod --
module externalmod.test/imports

-- .info --
{"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"}

-- go.mod --
module externalmod.test/imports

-- root/p.go --
package root

import "externalmod.test/imports/sub1"

type Type struct {
Sub1 sub1.Type
}
-- sub1/p.go --
package sub1

import "externalmod.test/imports/sub2"

type Type struct {
Sub2 sub2.Type
}
-- sub2/p.go --
package sub2

type Type struct {
Leaf int
}
16 changes: 15 additions & 1 deletion cmd/cue/cmd/testdata/script/get_go_non_local.txtar
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test that cue get go works when used without the --local flag

# cue get go currently appear to act like a wrapper around go get.
# cue get go currently appears to act like a wrapper around go get.
# But this is going to change: "cue get go" will be renamed "cue import go".
# When that change happens, cue import go will assume that all
# required dependencies are present, and fail otherwise.
Expand All @@ -15,8 +15,22 @@ cmp cue.mod/gen/externalmod.test/blah/blah_gen.cue cue.mod/gen/externalmod.test/
# Verify dependencies are as expected
cmp go.mod go.mod.golden

# Verify that all transitive dependencies are generated properly as well.
# If any are missing, the evaluation would fail to load them.
# TODO: broken due to https://cuelang.org/issue/3033.
go get externalmod.test/imports/[email protected]
exec cue get go externalmod.test/imports/root
! exec cue eval uses_imports_root.cue
stderr 'cannot find package "externalmod.test/imports/sub1"'

-- cue.mod/module.cue --
module: "mod.test/local"
-- uses_imports_root.cue --
package p

import "externalmod.test/imports/root"

root.Type

-- go.mod --
module mod.test/local
Expand Down
8 changes: 8 additions & 0 deletions cmd/cue/cmd/testdata/script/get_go_vendor.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
exec cue get go --local ./x
cmp x/x_go_gen.cue x_go_gen.cue.golden

# Verify that all transitive dependencies were generated properly.
# If any are missing, the evaluation would fail to load them.
# TODO: broken due to https://cuelang.org/issue/3033.
! exec cue eval ./x
stderr 'no CUE files in mod.test/z'

-- go.mod --
module mod.test

go 1.21
-- cue.mod/module.cue --
module: "mod.test"
-- x/x.go --
package x

Expand Down

0 comments on commit 81f5a20

Please sign in to comment.