mirror of
https://github.com/github/codeql.git
synced 2026-04-24 00:05:14 +02:00
Add test for cross-package references with test extraction
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
go 1.14
|
||||
go 1.18
|
||||
|
||||
module testsample
|
||||
|
||||
7
go/ql/integration-tests/test-extraction/src/pkg1/def.go
Normal file
7
go/ql/integration-tests/test-extraction/src/pkg1/def.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package pkg1
|
||||
|
||||
type Generic[T any] struct {
|
||||
element T
|
||||
}
|
||||
|
||||
func TestMe() { }
|
||||
@@ -0,0 +1,5 @@
|
||||
package pkg1
|
||||
|
||||
func UsePkg1() {
|
||||
TestMe()
|
||||
}
|
||||
12
go/ql/integration-tests/test-extraction/src/pkg2/use.go
Normal file
12
go/ql/integration-tests/test-extraction/src/pkg2/use.go
Normal file
@@ -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]
|
||||
@@ -1,8 +1,12 @@
|
||||
#select
|
||||
| src/pkg1/def.go:0:0:0:0 | src/pkg1/def.go |
|
||||
| src/pkg1/def_test.go:0:0:0:0 | src/pkg1/def_test.go |
|
||||
| src/pkg2/use.go:0:0:0:0 | src/pkg2/use.go |
|
||||
| src/testme.go:0:0:0:0 | src/testme.go |
|
||||
| src/testme_blackbox_test.go:0:0:0:0 | src/testme_blackbox_test.go |
|
||||
| src/testme_test.go:0:0:0:0 | src/testme_test.go |
|
||||
calls
|
||||
| src/pkg1/def_test.go:4:2:4:9 | call to TestMe | src/pkg1/def.go:7:1:7:17 | function declaration |
|
||||
| src/testme_blackbox_test.go:10:18:10:44 | call to PublicFunction | src/testme.go:3:1:3:38 | function declaration |
|
||||
| src/testme_test.go:9:18:9:33 | call to PublicFunction | src/testme.go:3:1:3:38 | function declaration |
|
||||
| src/testme_test.go:14:19:14:35 | call to privateFunction | src/testme.go:5:1:5:39 | function declaration |
|
||||
|
||||
Reference in New Issue
Block a user