This repository has been archived by the owner on Nov 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/cue: add goproxytest instance for script tests
This allows us to define modules as txtar archives that are served via a github.com/rogpeppe/go-internal/goproxytest.Server instance from within cmd/cue/cmd/testdata/mod that speaks the module download protocol. cmd/cue/cmd testscript tests are run with a GOPROXY value that is this local server, allowing us to support go get requests that are resolved locally, with modules that can be shared across testscript scripts. This will be used by various cue get go tests. Whilst we don't have full CUE module support, we can also use this proxy server as means of go get-ting CUE modules (that have a light Go module shim). The example.com/blah module defined in this change includes a .cue file as part of the Go module that forms part of a later cue get go test that verifies the vendoring of .cue files within the cue get go package arguments. Change-Id: I52351c02697ee3963576b1d9391e0aa56dada132 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/8291 Reviewed-by: CUE cueckoo <cueckoo@gmail.com> Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
- Loading branch information
Showing
3 changed files
with
62 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-- .mod -- | ||
module example.com/blah | ||
|
||
-- .info -- | ||
{"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"} | ||
|
||
-- go.mod -- | ||
module example.com/blah | ||
|
||
-- blah.go -- | ||
package blah | ||
|
||
// Some fruit | ||
const Name = "Orange" | ||
-- blah.cue -- | ||
package blah | ||
|
||
Type: "Fruit" |
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,29 @@ | ||
# Basic test to ensure that the goproxytest instance used by various testscript | ||
# tests works as expected. | ||
|
||
go get example.com/blah | ||
go mod tidy | ||
cmp go.mod go.mod.golden | ||
|
||
-- go.mod -- | ||
module rubbish | ||
|
||
go 1.14 | ||
-- main.go -- | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"example.com/blah" | ||
) | ||
|
||
func main() { | ||
fmt.Println(blah.Orange) | ||
} | ||
-- go.mod.golden -- | ||
module rubbish | ||
|
||
go 1.14 | ||
|
||
require example.com/blah v1.0.0 |