diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-11-16 22:39:00 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-11-16 22:43:31 +0000 |
| commit | ca8f1ddf605f447cdb416c46d254480afdc68ccc (patch) | |
| tree | 9e40a9fb0f442476baeb2b69c7efb826029aa173 /src/test/java/org/zwobble | |
| parent | 9118a7ff1db7c740bad4f196d094c41f5a3a3629 (diff) | |
Remove class names as a special case
Diffstat (limited to 'src/test/java/org/zwobble')
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMappingTokeniserTests.java | 9 | ||||
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/styles/parsing/TokenParserTests.java | 11 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMappingTokeniserTests.java b/src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMappingTokeniserTests.java index 0e0c920..7c11ef0 100644 --- a/src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMappingTokeniserTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMappingTokeniserTests.java @@ -36,6 +36,11 @@ public class StyleMappingTokeniserTests { } @Test + public void escapeSequencesInIdentifiersAreTokenised() { + assertTokens("\\:", isToken(TokenType.IDENTIFIER, "\\:")); + } + + @Test public void integersAreTokenised() { assertTokens("123", isToken(TokenType.INTEGER, "123")); } @@ -56,8 +61,8 @@ public class StyleMappingTokeniserTests { } @Test - public void classesAreTokenised() { - assertTokens(".overture", isToken(TokenType.CLASS_NAME, ".overture")); + public void dotsAreTokenised() { + assertTokens(".", isToken(TokenType.SYMBOL, ".")); } @Test diff --git a/src/test/java/org/zwobble/mammoth/tests/styles/parsing/TokenParserTests.java b/src/test/java/org/zwobble/mammoth/tests/styles/parsing/TokenParserTests.java index dabe2cd..ba0de10 100644 --- a/src/test/java/org/zwobble/mammoth/tests/styles/parsing/TokenParserTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/styles/parsing/TokenParserTests.java @@ -6,16 +6,19 @@ import org.zwobble.mammoth.internal.styles.parsing.TokenIterator; import org.zwobble.mammoth.internal.styles.parsing.TokenParser; import org.zwobble.mammoth.internal.styles.parsing.TokenType; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.zwobble.mammoth.internal.util.Lists.list; public class TokenParserTests { @Test - public void escapeSequencesInClassNameAreDecoded() { - String value = TokenParser.parseClassName(new TokenIterator<>(list( - new Token<>(0, TokenType.CLASS_NAME, "\\:") + public void escapeSequencesInIdentifiersAreDecoded() { + Optional<String> value = TokenParser.parseClassName(new TokenIterator<>(list( + new Token<>(0, TokenType.SYMBOL, "."), + new Token<>(1, TokenType.IDENTIFIER, "\\:") ))); - assertEquals(":", value); + assertEquals(Optional.of(":"), value); } @Test |
