forked from liquid-java/liquidjava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRJParserLiteralTest.java
More file actions
34 lines (26 loc) · 956 Bytes
/
RJParserLiteralTest.java
File metadata and controls
34 lines (26 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package rj.grammar;
import org.antlr.v4.runtime.*;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
public class RJParserLiteralTest {
@Test
void testIntegerLiteral() {
String input = "123";
RJLexer lexer = new RJLexer(CharStreams.fromString(input));
CommonTokenStream tokens = new CommonTokenStream(lexer);
RJParser parser = new RJParser(tokens);
RJParser.LiteralContext ctx = parser.literal();
assertNotNull(ctx);
assertEquals("123", ctx.getText());
}
@Test
void testBooleanLiteral() {
String input = "true";
RJLexer lexer = new RJLexer(CharStreams.fromString(input));
CommonTokenStream tokens = new CommonTokenStream(lexer);
RJParser parser = new RJParser(tokens);
RJParser.LiteralContext ctx = parser.literal();
assertNotNull(ctx);
assertEquals("true", ctx.getText());
}
}