Skip to content

Instantly share code, notes, and snippets.

View tenntenn's full-sized avatar

Takuya Ueda tenntenn

View GitHub Profile
@tenntenn
tenntenn / gist:3638566
Created September 5, 2012 15:34
gocov installation
$ go get github.com/axw/gocov/gocov
@tenntenn
tenntenn / gist:3638822
Created September 5, 2012 15:50
gocov test
$ gocov test > test.json
@tenntenn
tenntenn / gist:3638849
Created September 5, 2012 15:51
goconv test 2
$ goconv test packagename > test.json
@tenntenn
tenntenn / test.json
Created September 5, 2012 15:57
test json
{
"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,
@tenntenn
tenntenn / student.go
Created September 5, 2012 16:01
student.go
package student
import "fmt"
type Student struct {
id int
name string
}
func (s *Student) Id() int {
@tenntenn
tenntenn / gist:3639057
Created September 5, 2012 16:04
gocov report
$ gocov report test.json
@tenntenn
tenntenn / student_test.go
Created September 5, 2012 16:06
empty test code
package student
import (
"testing"
)
func TestNew(t *testing.T) {
}
@tenntenn
tenntenn / gist:3639107
Created September 5, 2012 16:07
report result1
$ 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)
@tenntenn
tenntenn / student_test.go
Created September 5, 2012 16:50
full test code
package student
import (
"testing"
)
func TestNewPanic(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Error("panicが発生しませんでした。")
@tenntenn
tenntenn / gist:3639817
Created September 5, 2012 16:52
test result2
$ 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)