mirror of
https://github.com/golang/go
synced 2024-09-30 01:34:35 -06:00
cmd/go: convert TestCoverageNoStatements to the script framework.
Part of converting all tests to script framework to improve test parallelism. Updates #36320 Updates #17751 Change-Id: Ie2c60ec0654ef605439beeed92cf5f1c2c8a1dd3 Reviewed-on: https://go-review.googlesource.com/c/go/+/213681 Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
8538f5f08f
commit
fcfc16694f
@ -2045,14 +2045,6 @@ func TestCoverageRuns(t *testing.T) {
|
||||
checkCoverage(tg, data)
|
||||
}
|
||||
|
||||
func TestCoverageNoStatements(t *testing.T) {
|
||||
tooSlow(t)
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.run("test", "-cover", "./testdata/testcover/pkg4")
|
||||
tg.grepStdout("[no statements]", "expected [no statements] for pkg4")
|
||||
}
|
||||
|
||||
func TestTestEmpty(t *testing.T) {
|
||||
if !canRace {
|
||||
t.Skip("no race detector")
|
||||
|
57
src/cmd/go/testdata/script/cover_statements.txt
vendored
Normal file
57
src/cmd/go/testdata/script/cover_statements.txt
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
[short] skip
|
||||
go test -cover ./pkg1 ./pkg2 ./pkg3 ./pkg4
|
||||
stdout 'pkg1 \[no test files\]'
|
||||
stdout 'pkg2 \S+ coverage: 0.0% of statements \[no tests to run\]'
|
||||
stdout 'pkg3 \S+ coverage: 100.0% of statements'
|
||||
stdout 'pkg4 \S+ coverage: \[no statements\]'
|
||||
|
||||
-- pkg1/a.go --
|
||||
package pkg1
|
||||
|
||||
import "fmt"
|
||||
|
||||
func F() {
|
||||
fmt.Println("pkg1")
|
||||
}
|
||||
-- pkg2/a.go --
|
||||
package pkg2
|
||||
|
||||
import "fmt"
|
||||
|
||||
func F() {
|
||||
fmt.Println("pkg2")
|
||||
}
|
||||
-- pkg2/a_test.go --
|
||||
package pkg2
|
||||
-- pkg3/a.go --
|
||||
package pkg3
|
||||
|
||||
import "fmt"
|
||||
|
||||
func F() {
|
||||
fmt.Println("pkg3")
|
||||
}
|
||||
-- pkg3/a_test.go --
|
||||
package pkg3
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestF(t *testing.T) {
|
||||
F()
|
||||
}
|
||||
-- pkg4/a.go --
|
||||
package pkg4
|
||||
|
||||
type T struct {
|
||||
X bool
|
||||
}
|
||||
-- pkg4/a_test.go --
|
||||
package pkg4
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestT(t *testing.T) {
|
||||
_ = T{}
|
||||
}
|
7
src/cmd/go/testdata/testcover/pkg1/a.go
vendored
7
src/cmd/go/testdata/testcover/pkg1/a.go
vendored
@ -1,7 +0,0 @@
|
||||
package pkg1
|
||||
|
||||
import "fmt"
|
||||
|
||||
func F() {
|
||||
fmt.Println("pkg1")
|
||||
}
|
7
src/cmd/go/testdata/testcover/pkg2/a.go
vendored
7
src/cmd/go/testdata/testcover/pkg2/a.go
vendored
@ -1,7 +0,0 @@
|
||||
package pkg2
|
||||
|
||||
import "fmt"
|
||||
|
||||
func F() {
|
||||
fmt.Println("pkg2")
|
||||
}
|
1
src/cmd/go/testdata/testcover/pkg2/a_test.go
vendored
1
src/cmd/go/testdata/testcover/pkg2/a_test.go
vendored
@ -1 +0,0 @@
|
||||
package pkg2
|
7
src/cmd/go/testdata/testcover/pkg3/a.go
vendored
7
src/cmd/go/testdata/testcover/pkg3/a.go
vendored
@ -1,7 +0,0 @@
|
||||
package pkg3
|
||||
|
||||
import "fmt"
|
||||
|
||||
func F() {
|
||||
fmt.Println("pkg3")
|
||||
}
|
7
src/cmd/go/testdata/testcover/pkg3/a_test.go
vendored
7
src/cmd/go/testdata/testcover/pkg3/a_test.go
vendored
@ -1,7 +0,0 @@
|
||||
package pkg3
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestF(t *testing.T) {
|
||||
F()
|
||||
}
|
5
src/cmd/go/testdata/testcover/pkg4/a.go
vendored
5
src/cmd/go/testdata/testcover/pkg4/a.go
vendored
@ -1,5 +0,0 @@
|
||||
package pkg4
|
||||
|
||||
type T struct {
|
||||
X bool
|
||||
}
|
9
src/cmd/go/testdata/testcover/pkg4/a_test.go
vendored
9
src/cmd/go/testdata/testcover/pkg4/a_test.go
vendored
@ -1,9 +0,0 @@
|
||||
package pkg4
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestT(t *testing.T) {
|
||||
_ = T{}
|
||||
}
|
Loading…
Reference in New Issue
Block a user