mirror of
https://github.com/golang/go
synced 2024-11-17 09:44:48 -07:00
cmd/go: allow a package that ends with _test having an internal test package
Fixes #45477 Change-Id: I2f1ed281515ec40d31fd07ce9f4901777691bfa7
This commit is contained in:
parent
e8cda0a6c9
commit
7894d9400c
12
src/cmd/go/testdata/script/test_issue45477.txt
vendored
Normal file
12
src/cmd/go/testdata/script/test_issue45477.txt
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
[short] skip # links and runs a test binary
|
||||
|
||||
go test -v .
|
||||
|
||||
-- go.mod --
|
||||
module example.com/pkg_test
|
||||
|
||||
-- pkg.go --
|
||||
package pkg_test
|
||||
|
||||
-- pkg_test.go --
|
||||
package pkg_test
|
@ -894,7 +894,7 @@ Found:
|
||||
|
||||
isTest := strings.HasSuffix(name, "_test.go")
|
||||
isXTest := false
|
||||
if isTest && strings.HasSuffix(pkg, "_test") {
|
||||
if isTest && strings.HasSuffix(pkg, "_test") && p.Name != pkg {
|
||||
isXTest = true
|
||||
pkg = pkg[:len(pkg)-len("_test")]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user