1
0
mirror of https://github.com/golang/go synced 2024-10-05 09:21:22 -06:00
Commit Graph

8 Commits

Author SHA1 Message Date
Caio Marcelo de Oliveira Filho
e7f6d8b2d7 cmd/cover: don't overskip children nodes when adding counters
When visiting the AST to add counters, there are special cases in which
the code calls cuts the walking short by returning nil. In some cases
certain nodes are ignored, e.g. Init and Cond inside IfStmt.

The fix is to explicitly walk all the children nodes (not only
Body and Else) when cutting the current walk. Similar approach
was taken with SwitchStmt and TypeSwitchStmt.

While the existing test code doesn't handle different counters in the
same line, the generated HTML report does it correctly (because it takes
column into account).

The previous behavior caused lines in function literals to not be
tracked when those literals were inside Init or Cond of an IfStmt for
example.

Fixes #14039.

Change-Id: Iad591363330843ad833bd79a0388d709c8d0c8aa
Reviewed-on: https://go-review.googlesource.com/19775
Reviewed-by: Rob Pike <r@golang.org>
2016-02-22 21:06:57 +00:00
Shenghou Ma
98abf2937e cmd/cover: allow part selection to be retained across page refreshes
Usually, you are primarily interested to see the coverage of a particular
file (e.g. when you're changing tests that affects a given source file),
it is very valuable if you can just refresh the page and immediately see
changes to the part you're already looking at (without selecting from the
selector again.)

Change-Id: I615207c9be6713f436e444771134fceaf4600ff3
Reviewed-on: https://go-review.googlesource.com/17238
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-27 06:13:12 +00:00
Russ Cox
7bc3e58806 all: extract "can I exec?" check from tests into internal/testenv
Change-Id: I7b54be9d8b50b39e01c6be21f310ae9a10404e9d
Reviewed-on: https://go-review.googlesource.com/10753
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-16 18:07:36 +00:00
Dave Cheney
26301b6cfd cmd/cover: fix missing error check in test
Fix missing error check in test.

Spotted by Gordon Klass, https://groups.google.com/forum/#!topic/golang-nuts/MdDLbvOjb4o

Change-Id: I22f1a438cbb60a2fe1740fc2d43fbf8aa008b6de
Reviewed-on: https://go-review.googlesource.com/10605
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-02 05:23:55 +00:00
Dave Cheney
ffd334493c cmd/cover: fix build
Fix the various builds which don't have a real filesystem or don't support forking.

Change-Id: I3075c662fe6191ecbe70ba359b73d9a88bb06f35
Reviewed-on: https://go-review.googlesource.com/9528
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-05-01 03:32:37 +00:00
Rob Pike
bc1410a4f9 cmd/cover: try once again to fix the build
Forgot to update the references to the old cover package. No excuse.

Change-Id: If17b7521f0bf70bc0c8da9c5adf246d90f644637
Reviewed-on: https://go-review.googlesource.com/9564
Reviewed-by: Rob Pike <r@golang.org>
2015-05-01 02:15:46 +00:00
Rob Pike
e0820ac8d1 cmd/cover: fix build
TBR=rsc

Change-Id: I6ec69013027213c5e7adedd2edb89dea6af876d9
Reviewed-on: https://go-review.googlesource.com/9563
Reviewed-by: Rob Pike <r@golang.org>
2015-05-01 02:12:17 +00:00
Rob Pike
5eddc5bae3 cmd/cover: copy to standard repository from golang.org/x/tools/cmd/cover
This required dealing with the ill-advised split of the profile code
into a separate package. I just copied it over unchanged. The package
does not deserve to be in the standard repository. We can cope
with the duplication.

Also update the go command to know about the new location.

Fixes #10528.

Change-Id: I05170ef3663326d57b9c18888d01163acd9256b6
Reviewed-on: https://go-review.googlesource.com/9560
Reviewed-by: Russ Cox <rsc@golang.org>
2015-05-01 00:40:09 +00:00