Skip to content

Commit

Permalink
test: show code coverage numbers per function
Browse files Browse the repository at this point in the history
We have added a visualization of code coverage in Coveralls, but
sometimes it is convenient to show percents of covered statements
locally without pushing to remote branch and running CI.

Example of output:

$ go tool cover -func=coverage.out

github.com/tarantool/go-tarantool/auth.go:8:           scramble       90.9%
github.com/tarantool/go-tarantool/auth.go:36:          xor            100.0%
github.com/tarantool/go-tarantool/client_tools.go:13:  EncodeMsgpack  100.0%
github.com/tarantool/go-tarantool/client_tools.go:25:  EncodeMsgpack  100.0%
github.com/tarantool/go-tarantool/client_tools.go:37:  EncodeMsgpack  0.0%
github.com/tarantool/go-tarantool/client_tools.go:49:  EncodeMsgpack  0.0%
github.com/tarantool/go-tarantool/client_tools.go:63:  EncodeMsgpack  0.0%
github.com/tarantool/go-tarantool/client_tools.go:78:  EncodeMsgpack  0.0%
github.com/tarantool/go-tarantool/connection.go:67:    Report         0.0%
...
  • Loading branch information
ligurio committed May 19, 2022
1 parent 18db003 commit 5fe87cd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ coverage:
go clean -testcache
go get golang.org/x/tools/cmd/cover
go test ./... -v -p 1 -covermode=atomic -coverprofile=$(COVERAGE_FILE) -coverpkg=./...
go tool cover -func=$(COVERAGE_FILE)

.PHONY: coveralls
coveralls: coverage
Expand Down

0 comments on commit 5fe87cd

Please sign in to comment.