From 6fabfd9fd0eb381346a4ab08606ff4cf9cb502d1 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Wed, 18 Sep 2024 23:28:27 -0400 Subject: [PATCH] Test whether tokens reference the same memory as runes --- parse_test.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/parse_test.go b/parse_test.go index 5c9ce4c..f8334e6 100644 --- a/parse_test.go +++ b/parse_test.go @@ -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) + } }