Test whether tokens reference the same memory as runes

This commit is contained in:
Sasha Koshka 2024-09-18 23:28:27 -04:00
parent 6b6e485aca
commit 6fabfd9fd0

View File

@ -121,6 +121,12 @@ func TestParseString (test *testing.T) {
logTokens(test, correctTokens)
test.FailNow()
}
// TODO: ensure runeLayout slices in the tokens reference the same
// memory as the complete runes slice
test.Logf("changing first rune from %c to x", runes[0].run)
runes[0].run = 'x'
tokenRune := tokens[0].runes[0].run
if tokenRune != 'x' {
test.Fatalf (
"tokens does not reference the same memory as runes after changing runes: %c, %c",
runes[0].run, tokenRune)
}
}