diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-04-18 13:28:04 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-04-18 13:28:04 +0100 |
| commit | dda81e22bd1274d54e627e284c49ded9aa1c0b04 (patch) | |
| tree | 1361e34bf38d9ade50a7f65e6278782ede4980ef /src/test | |
| parent | 00592db2490ac6274b3926fd007365d2c50327a8 (diff) | |
Skip whitespace
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/java/org/zwobble/hobgoblin/parser/TokenizerTests.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/java/org/zwobble/hobgoblin/parser/TokenizerTests.java b/src/test/java/org/zwobble/hobgoblin/parser/TokenizerTests.java index 52c5f79..67ecc1e 100644 --- a/src/test/java/org/zwobble/hobgoblin/parser/TokenizerTests.java +++ b/src/test/java/org/zwobble/hobgoblin/parser/TokenizerTests.java @@ -40,6 +40,17 @@ public class TokenizerTests { )); } + @Test + public void whitespaceIsIgnored() { + var sourceText = SourceText.fromString("<string>", " blah "); + + var tokens = Tokenizer.tokenize(sourceText); + + assertThat(tokens, isSequence( + equalTo(new Token(TokenType.IDENTIFIER, sourceRange(sourceText, 2, 6))) + )); + } + private static SourceRange sourceRange(SourceText sourceText, int fromCharacterIndex, int toCharacterIndex) { return sourceText.characterPosition(fromCharacterIndex).to(sourceText.characterPosition(toCharacterIndex)); } |
