-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve/gosource: add rel file query with multiple main packages test
Add a testcase for the gosource resolver that specifies as file query pattern cmd/**/main.go and runs the goresolver from a different directory then the test (aka app dir) directory. This testcase currently fails because the relative file query patterns are not relative to the specified working dir (app dir) but to the cwd (golang/go#65965). The existing testcase query_main_file is refactored for this purpose The test_config.json files got a new field WorkingDir, the $WORKDIR test_config.json variable is renamed to $TESTDIR.
- Loading branch information
Showing
38 changed files
with
223 additions
and
163 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
17 changes: 10 additions & 7 deletions
17
internal/resolve/gosource/testdata/embedded_file/test_config.json
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 |
---|---|---|
@@ -1,14 +1,17 @@ | ||
{ | ||
"Cfg": { | ||
"Queries": ["./..."], | ||
"WorkingDir": "$TESTDIR", | ||
"Queries": [ | ||
"./..." | ||
], | ||
"Tests": true | ||
}, | ||
"ExpectedResults": [ | ||
"$WORKDIR/main.go", | ||
"$WORKDIR/embed_test.go", | ||
"$WORKDIR/hello.txt", | ||
"$WORKDIR/data/a.txt", | ||
"$WORKDIR/data/b.txt", | ||
"$WORKDIR/hello_test.txt" | ||
"$TESTDIR/main.go", | ||
"$TESTDIR/embed_test.go", | ||
"$TESTDIR/hello.txt", | ||
"$TESTDIR/data/a.txt", | ||
"$TESTDIR/data/b.txt", | ||
"$TESTDIR/hello_test.txt" | ||
] | ||
} |
49 changes: 26 additions & 23 deletions
49
internal/resolve/gosource/testdata/go_mod_non_vendored_deps/test_config.json
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 |
---|---|---|
@@ -1,25 +1,28 @@ | ||
{ | ||
"Cfg": { | ||
"Environment": [ | ||
"GO111MODULE=on", | ||
"GOFLAGS=-mod=readonly" | ||
], | ||
"Queries": ["file=./main.go"] | ||
}, | ||
"ExpectedResults": [ | ||
"$WORKDIR/main.go", | ||
"$WORKDIR/generator/generator.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/dce.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/doc.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/hash.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/marshal.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/node.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/node_net.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/sql.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/time.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/util.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/uuid.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/version1.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/version4.go" | ||
] | ||
"Cfg": { | ||
"WorkingDir": "$TESTDIR", | ||
"Environment": [ | ||
"GO111MODULE=on", | ||
"GOFLAGS=-mod=readonly" | ||
], | ||
"Queries": [ | ||
"file=./main.go" | ||
] | ||
}, | ||
"ExpectedResults": [ | ||
"$TESTDIR/main.go", | ||
"$TESTDIR/generator/generator.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/dce.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/doc.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/hash.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/marshal.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/node.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/node_net.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/sql.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/time.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/util.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/uuid.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/version1.go", | ||
"$GOMODCACHE/github.com/google/uuid@v1.1.1/version4.go" | ||
] | ||
} |
File renamed without changes.
11 changes: 11 additions & 0 deletions
11
internal/resolve/gosource/testdata/multiple_mains_doublestar_file_query/cmd/two/main.go
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,11 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/simplesurance/baur-test/intstr" | ||
) | ||
|
||
func main() { | ||
fmt.Println(intstr.One) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
internal/resolve/gosource/testdata/multiple_mains_doublestar_file_query/intstr/intstr.go
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,3 @@ | ||
package intstr | ||
|
||
const One = "One" |
30 changes: 30 additions & 0 deletions
30
internal/resolve/gosource/testdata/multiple_mains_doublestar_file_query/test_config.json
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,30 @@ | ||
{ | ||
"Cfg": { | ||
"WorkingDir": "$TESTDIR/..", | ||
"Environment": [ | ||
"GO111MODULE=on", | ||
"GOFLAGS=-mod=vendor" | ||
], | ||
"Queries": [ | ||
"fileglob=cmd/**/main.go" | ||
] | ||
}, | ||
"ExpectedResults": [ | ||
"$TESTDIR/cmd/one/main.go", | ||
"$TESTDIR/cmd/two/main.go", | ||
"$TESTDIR/generator/generator.go", | ||
"$TESTDIR/intstr/intstr.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/dce.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/doc.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/hash.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/marshal.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/node.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/node_net.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/sql.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/time.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/util.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/uuid.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/version1.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/version4.go" | ||
] | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
37 changes: 20 additions & 17 deletions
37
internal/resolve/gosource/testdata/query_fileglob_all_test_files/test_config.json
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 |
---|---|---|
@@ -1,28 +1,31 @@ | ||
{ | ||
"Cfg": { | ||
"WorkingDir": "$TESTDIR", | ||
"Environment": [ | ||
"GO111MODULE=on", | ||
"GOFLAGS=-mod=vendor" | ||
], | ||
"Queries": ["fileglob=**/*_test.go"], | ||
"Queries": [ | ||
"fileglob=**/*_test.go" | ||
], | ||
"Tests": true | ||
}, | ||
"ExpectedResults": [ | ||
"$WORKDIR/main.go", | ||
"$WORKDIR/main_test.go", | ||
"$WORKDIR/generator/generator.go", | ||
"$WORKDIR/generator/generator_test.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/dce.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/doc.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/hash.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/marshal.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/node.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/node_net.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/sql.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/time.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/util.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/uuid.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/version1.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/version4.go" | ||
"$TESTDIR/main.go", | ||
"$TESTDIR/main_test.go", | ||
"$TESTDIR/generator/generator.go", | ||
"$TESTDIR/generator/generator_test.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/dce.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/doc.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/hash.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/marshal.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/node.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/node_net.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/sql.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/time.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/util.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/uuid.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/version1.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/version4.go" | ||
] | ||
} |
37 changes: 21 additions & 16 deletions
37
internal/resolve/gosource/testdata/query_fileglob_all_test_files_buildtag/test_config.json
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 |
---|---|---|
@@ -1,27 +1,32 @@ | ||
{ | ||
"Cfg": { | ||
"WorkingDir": "$TESTDIR", | ||
"Environment": [ | ||
"GO111MODULE=on", | ||
"GOFLAGS=-mod=vendor" | ||
], | ||
"Queries": ["fileglob=**/*_test.go"], | ||
"BuildFlags": ["-tags=generatortest"], | ||
"Queries": [ | ||
"fileglob=**/*_test.go" | ||
], | ||
"BuildFlags": [ | ||
"-tags=generatortest" | ||
], | ||
"Tests": true | ||
}, | ||
"ExpectedResults": [ | ||
"$WORKDIR/generator/generator.go", | ||
"$WORKDIR/generator/generator_test.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/dce.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/doc.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/hash.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/marshal.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/node.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/node_net.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/sql.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/time.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/util.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/uuid.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/version1.go", | ||
"$WORKDIR/vendor/github.com/google/uuid/version4.go" | ||
"$TESTDIR/generator/generator.go", | ||
"$TESTDIR/generator/generator_test.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/dce.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/doc.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/hash.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/marshal.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/node.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/node_net.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/sql.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/time.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/util.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/uuid.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/version1.go", | ||
"$TESTDIR/vendor/github.com/google/uuid/version4.go" | ||
] | ||
} |
25 changes: 0 additions & 25 deletions
25
internal/resolve/gosource/testdata/query_main_file/test_config.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.