forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request github#17637 from smowton/smowton/admin/go-test-ex…
…traction-tests Go: augment test-extraction tests
- Loading branch information
Showing
7 changed files
with
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
go 1.14 | ||
go 1.18 | ||
|
||
module testsample |
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,7 @@ | ||
package pkg1 | ||
|
||
type Generic[T any] struct { | ||
element T | ||
} | ||
|
||
func TestMe() {} |
9 changes: 9 additions & 0 deletions
9
go/ql/integration-tests/test-extraction/src/pkg1/def_blackbox_test.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,9 @@ | ||
package pkg1_test | ||
|
||
import ( | ||
"testsample/pkg1" | ||
) | ||
|
||
func UsePkg1() { | ||
pkg1.TestMe() | ||
} |
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,5 @@ | ||
package pkg1 | ||
|
||
func UsePkg1() { | ||
TestMe() | ||
} |
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,12 @@ | ||
package pkg2 | ||
|
||
import ( | ||
"testsample/pkg1" | ||
) | ||
|
||
// This tests the case of cross-package generic type references | ||
// in the presence of test extraction. We need to make sure we | ||
// extract packages, including test variants, in the right order | ||
// such that we've seen pkg1.Generic before we try to use it here. | ||
|
||
type Specialised = pkg1.Generic[string] |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import os | ||
|
||
def test_traced(codeql, go): | ||
codeql.database.create(source_root="src", command="go test -c") | ||
codeql.database.create(source_root="src", command="go test -c ./...") | ||
|
||
def test_autobuild(codeql, go): | ||
codeql.database.create(source_root="src", extractor_option = ["extract_tests=true"]) |