1
0
mirror of https://github.com/golang/go synced 2024-11-24 00:20:14 -07:00

net/url: don't assume b.N > 0

Change-Id: Ie79c16d6e61b3baa274069528cf883b22fd255fe
Reviewed-on: https://go-review.googlesource.com/20855
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Marcel van Lohuizen 2016-03-18 16:41:38 +01:00 committed by Russ Cox
parent d3ce412fa5
commit 3e2e80599e

View File

@ -611,7 +611,7 @@ func BenchmarkString(b *testing.B) {
g = u.String()
}
b.StopTimer()
if w := tt.roundtrip; g != w {
if w := tt.roundtrip; b.N > 0 && g != w {
b.Errorf("Parse(%q).String() == %q, want %q", tt.in, g, w)
}
}