antlr / antlr5

BSD 3-Clause "New" or "Revised" License
57 stars 5 forks source link

Improve testing infrastructure #25

Closed KvanTTT closed 9 months ago

KvanTTT commented 9 months ago

Porting a PR from ANTLR4 repository (https://github.com/antlr/antlr4/pull/4301)

It provides several small goals instead of single big one:

[grammar]
parser grammar Parser;

options { tokenVocab=Lexer; } 
...

[grammar]
lexer grammar Lexer;
...

It allows to port TestParserExec hardcoded tests to descriptors and check all runtimes instead of only Java.

- [type]
- Parser
-
ExecutedState executedState = execParser(grammar, "a", "x", true);

instead of

ExecutedState executedState = execParser("T.g4", grammar, "TParser", "TLexer", "a", "x", true);

Also, it changes only testing infastructure but not core or runtimes. There are a lot of massive changes to test data because of removing redundant info.

It can be considered as follow-up of Runtime tests refactoring and Runtime tests refactoring 2.