Commit 7ff8e90e authored by Rui Ueyama's avatar Rui Ueyama Committed by Ian Lance Taylor

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
parent 2653386c
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment