forked from liquid-java/liquidjava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRJParserIntegrationTest.java
More file actions
28 lines (22 loc) · 880 Bytes
/
RJParserIntegrationTest.java
File metadata and controls
28 lines (22 loc) · 880 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
package rj.grammar;
import org.antlr.v4.runtime.*;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
public class RJParserIntegrationTest {
@Test
void testFullProgramParsing() {
String input = """
type MyAlias(int x) {
!(x < 5)
}
ghost int myGhost(int y)
""";
RJLexer lexer = new RJLexer(CharStreams.fromString(input));
CommonTokenStream tokens = new CommonTokenStream(lexer);
RJParser parser = new RJParser(tokens);
RJParser.ProgContext ctx = parser.prog();
assertNotNull(ctx, "O contexto do programa não deve ser nulo");
assertNotNull(ctx.start(), "Deve conter uma regra start válida");
assertEquals(0, parser.getNumberOfSyntaxErrors(), "O parser não deve gerar erros");
}
}