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
$ go get github.com/axw/gocov/gocov |
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
$ gocov test > test.json |
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
$ goconv test packagename > test.json |
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
{ | |
"Packages": [ | |
{ | |
"Name": "student", | |
"Functions": [ | |
{ | |
"Name": "Student.Id", | |
"File": "/Users/ueda/Documents/program/go/src/github.com/tenntenn/gocov-sample/student.go", | |
"Start": 83, | |
"End": 129, |
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
package student | |
import "fmt" | |
type Student struct { | |
id int | |
name string | |
} | |
func (s *Student) Id() int { |
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
$ gocov report test.json |
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
package student | |
import ( | |
"testing" | |
) | |
func TestNew(t *testing.T) { | |
} |
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
$ gocov report test.json | |
student/student.go New 0.00% (0/3) | |
student/student.go Student.Id 0.00% (0/1) | |
student/student.go Student.Name 0.00% (0/1) | |
student/student.go Student.String 0.00% (0/1) |
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
package student | |
import ( | |
"testing" | |
) | |
func TestNewPanic(t *testing.T) { | |
defer func() { | |
if r := recover(); r == nil { | |
t.Error("panicが発生しませんでした。") |
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
$ gocov test | gocov report | |
warning: building out-of-date packages: | |
github.com/axw/gocov | |
installing these packages with 'go test -i github.com/axw/gocov/instrumented/github.com/tenntenn/gocov-sample' will speed future tests. | |
ok github.com/axw/gocov/instrumented/github.com/tenntenn/gocov-sample 0.006s | |
student/student.go New 100.00% (3/3) | |
student/student.go Student.Id 100.00% (1/1) | |
student/student.go Student.Name 100.00% (1/1) |
OlderNewer