This peculiar case arose in range statements but there are other contexts
and one turned up in the auto-generated translation of the compiler.
Take care of it always.
for i := 0; i < 0; func() {i++; q=q.Link}() { ... }
That code has been given the obvious rewrite but we should still handle it.
Odd but easy to fix (tricky to test).
Fixes#10269.
Change-Id: I66e1404eb24da15a24be7f67403e19ed66fba0a7
Reviewed-on: https://go-review.googlesource.com/8284
Reviewed-by: Robert Griesemer <gri@golang.org>
Given
x()
panic(1)
y()
the y should not show as covered.
Fixes#10185
Change-Id: Iec61f1b096a888e6727be5f4526508654f5d3c91
Reviewed-on: https://go-review.googlesource.com/8140
Reviewed-by: Robert Griesemer <gri@golang.org>
Silly test added yesterday requires that some code in a goroutine executes.
Make sure it does.
Change-Id: I7e852454736e300151473986cc437a70b41dc9b7
Reviewed-on: https://go-review.googlesource.com/7691
Reviewed-by: Russ Cox <rsc@golang.org>
Just missed a case (ha!) in the tree walk. Dup the code for an empty switch, add test.
Fixes#10163.
Change-Id: I3d50ab6cb450ca21e87213291eaab8cbe924fac5
Reviewed-on: https://go-review.googlesource.com/7641
Reviewed-by: Andrew Gerrand <adg@golang.org>
Break the basic block at the function literal. The code to do this analysis
was already there; this CL just factors it out more nicely and uses it in
one new place. Also adds a test.
Fixesgolang/go#6555.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/14601043
This requires a little more tree rewriting to put a block around the if of an "else if".
More tests too.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11042045
Test the statistics work as expected for a simple program, which can be extended as needed. This is all a bit meta.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10392050