...
1[short] skip
2[compiler:gccgo] skip # gccgo has no cover tool
3
4# Test cover for a package that has an assembly function.
5
6go test -outputdir=$WORK -coverprofile=cover.out coverasm
7go tool cover -func=$WORK/cover.out
8stdout '\tg\t*100.0%' # Check g is 100% covered.
9! stdout '\tf\t*[0-9]' # Check for no coverage on the assembly function
10
11-- go.mod --
12module coverasm
13
14go 1.16
15-- p.go --
16package p
17
18func f()
19
20func g() {
21 println("g")
22}
23-- p.s --
24// empty asm file,
25// so go test doesn't complain about declaration of f in p.go.
26-- p_test.go --
27package p
28
29import "testing"
30
31func Test(t *testing.T) {
32 g()
33}
View as plain text