From: Rui Ueyama Date: Tue, 22 Apr 2014 00:00:27 +0000 (-0700) Subject: strings: fix off-by-one error in test X-Git-Tag: go1.3beta1 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7ff8e90eb7ceb2016aa9fc736febd8a5902ec65e;p=gostls13.git strings: fix off-by-one error in test Previously it would panic because of out-of-bound access if s1 is longer than s2. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/90110043 --- diff --git a/src/pkg/strings/strings_test.go b/src/pkg/strings/strings_test.go index 8347818d59..95a42019a3 100644 --- a/src/pkg/strings/strings_test.go +++ b/src/pkg/strings/strings_test.go @@ -652,7 +652,7 @@ func equal(m string, s1, s2 string, t *testing.T) bool { e1 := Split(s1, "") e2 := Split(s2, "") for i, c1 := range e1 { - if i > len(e2) { + if i >= len(e2) { break } r1, _ := utf8.DecodeRuneInString(c1)