The code coverage tool marks whole basic blocks as being covered when a statement in the middle panics. This can be quite confusing when the panics are converted to errors elsewhere with recover.
...
panic("...")
somecode // This is marked as covered.
A whole example example repo can be found in https://github.com/taruti/coverpanicbug and be triggered with "go test -cover" which falsely claims 100% coverage.
Go version 1.4.1 linux/amd64 and tools repo revision 2206711.
The text was updated successfully, but these errors were encountered:
mikioh
changed the title
cover: when a panic occurs cover still marks the whole basic block covered
cmd/cover: when a panic occurs cover still marks the whole basic block covered
Mar 17, 2015
The code coverage tool marks whole basic blocks as being covered when a statement in the middle panics. This can be quite confusing when the panics are converted to errors elsewhere with recover.
A whole example example repo can be found in https://github.com/taruti/coverpanicbug and be triggered with "go test -cover" which falsely claims 100% coverage.
Go version 1.4.1 linux/amd64 and tools repo revision 2206711.
The text was updated successfully, but these errors were encountered: