mirror of
https://github.com/golang/go
synced 2024-11-12 09:20:22 -07:00
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
This commit is contained in:
parent
2653386ce8
commit
7ff8e90eb7
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user