Hello,
I am looking for a way to change the start symbol for parsing in unit tests.
Example Pseudo-Grammar:
Model:
list+=AbstractNode*;
AbstractNode:
NodeA | NodeB;
NodeA:
attr1=Timeframe
attr2=SomeNode;
NodeB:
attr1=Timeframe
attr2=SomeOtherNode;
Timeframe:
"[" startDate=Date ":" endDate=Date "]";
I want to test my "Timeframe" directly without having to start from the Model.
Example Test (broken )
...
@Inject extension ParseHelper<Timeframe>
@Test
def void myBrokenTest(){
val timeframe = '''[10.10.2018:11.10.2018]'''.parse
AssertSomething("...",timeframe.startDate)
}
Error: My val timeframe is null.
If this could work somehow I would appreciate code samples
but I'm also happy for alternative solutions that allow me to test
single symbols without having to hardcode everything above it (coming
from the model).
Thank you :)