diff options
| author | Tobias Klauser <tklauser@distanz.ch> | 2018-08-21 14:27:07 +0200 |
|---|---|---|
| committer | Tobias Klauser <tobias.klauser@gmail.com> | 2018-08-22 06:54:03 +0000 |
| commit | f4e4ec2cd09c2f9d821f3cb6f47edd7c41a90b25 (patch) | |
| tree | 6e7a68416f1c007d6621c58aee5a7b595535eea4 | |
| parent | a0a7e9fc0c9139053c9ae02b85f03e78fb9cd550 (diff) | |
| download | go-f4e4ec2cd09c2f9d821f3cb6f47edd7c41a90b25.tar.xz | |
cmd/cover: fix off-by-one error in TestCoverHTML
Avoid index out of range if len(goldenLines) == len(outLines) + 1
Change-Id: Ic23a85d2b8dd06a615e35a58331e78abe4ad6703
Reviewed-on: https://go-review.googlesource.com/130396
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
| -rw-r--r-- | src/cmd/cover/cover_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/cover/cover_test.go b/src/cmd/cover/cover_test.go index c818819c39..8eb7124aad 100644 --- a/src/cmd/cover/cover_test.go +++ b/src/cmd/cover/cover_test.go @@ -314,7 +314,7 @@ func TestCoverHTML(t *testing.T) { // Compare at the line level, stopping at first different line so // we don't generate tons of output if there's an inserted or deleted line. for i, goldenLine := range goldenLines { - if i > len(outLines) { + if i >= len(outLines) { t.Fatalf("output shorter than golden; stops before line %d: %s\n", i+1, goldenLine) } // Convert all white space to simple spaces, for easy comparison. |
