From 7ff8e90eb7ceb2016aa9fc736febd8a5902ec65e Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Mon, 21 Apr 2014 17:00:27 -0700 Subject: 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 --- src/pkg/strings/strings_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.3-54-g00ecf