mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 08:18:55 +00:00
add test for alternatives with only unguarded paths
This commit is contained in:
parent
61847d2d82
commit
cb606d6937
1 changed files with 17 additions and 0 deletions
|
@ -294,6 +294,23 @@ public class HoistingProcessorTest extends AbstractXtextTests {
|
|||
assertEquals("((" + getSyntaxForKeywordToken("j", 10) + " || ((p0) || (p1))) && (" + getSyntaxForKeywordToken("k", 10) + " || (p2)))", guard.render());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAlternativeUnguarded() throws Exception {
|
||||
// @formatter:off
|
||||
String model =
|
||||
MODEL_PREAMBLE +
|
||||
"S: {S} 'a' \n" +
|
||||
" | {S} 'b' ;";
|
||||
// @formatter:off
|
||||
XtextResource resource = getResourceFromString(model);
|
||||
Grammar grammar = ((Grammar) resource.getContents().get(0));
|
||||
AbstractRule rule = getRule(grammar, "S");
|
||||
|
||||
HoistingGuard guard = hoistingProcessor.findGuardForElement(rule.getAlternatives());
|
||||
assertTrue(guard.isTrivial());
|
||||
assertTrue(guard.hasTerminal());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAlternativeUnguardedPath() throws Exception {
|
||||
// @formatter:off
|
||||
|
|
Loading…
Reference in a new issue