1
1
mirror of https://github.com/walles/moar.git synced 2024-09-21 09:01:30 +03:00

Fix off-by-X problems comparing strings

Due to byte offsets vs rune offsets.

This fixes some invalid test failures.
This commit is contained in:
Johan Walles 2021-04-25 13:21:03 +02:00
parent 5e59515d3f
commit b17c44af28

View File

@ -57,7 +57,8 @@ func TestTokenize(t *testing.T) {
}
// Tokens and plain have the same lengths, compare contents
for index, plainChar := range plainString {
plainStringChars := []rune(plainString)
for index, plainChar := range plainStringChars {
cellChar := tokens[index]
if cellChar.Rune == plainChar {
continue