@Test
public void test_Parse_LiteralNameOrReference_Ok() {
PPGrammarAccess ga = (PPGrammarAccess) getGrammarAccess();
PPParser parser = (PPParser) getParser();
for(String s : validNames) {
IParseResult result = parser.parse(ga.getUnionNameOrReferenceRule(), new StringReader(s));
assertFalse("Should not have errors for: " + s, result.hasSyntaxErrors());
assertEquals("parsed should be same as input", s, result.getRootNode().getText());
}
for(String s : validNames) {
if("class".equals(s))
continue; // 'class' alone is not a valid value expression
IParseResult result = parser.parse(ga.getExpressionRule(), new StringReader(s));
assertFalse("Should not have errors for: " + s, result.hasSyntaxErrors());
assertEquals("parsed should be same as input", s, result.getRootNode().getText());
EObject root = result.getRootASTElement();
// if("class".equals(s)) {
// assertTrue("Should be ResourceExpression", root instanceof ResourceExpression);
// }
// else {
assertTrue("Should be LiteralNameOrReference", root instanceof LiteralNameOrReference);
assertEquals("Literal should be same as input", s, ((LiteralNameOrReference) root).getValue());
// }
}
for(String s : validNames) {
if("class".equals(s))
continue; // 'class' alone is not a balid value expression
IParseResult result = parser.parse(ga.getPuppetManifestRule(), new StringReader(s));
assertFalse("Should not have errors for: " + s, result.hasSyntaxErrors());
assertEquals("parsed should be same as input", s, result.getRootNode().getText());
EObject root = result.getRootASTElement();
assertTrue("Should be PuppetManifest", root instanceof PuppetManifest);
PuppetManifest pm = (PuppetManifest) root;
assertTrue("Manifest should have statements", pm.getStatements().size() > 0);
EObject expr = pm.getStatements().get(0);
// if("class".equals(s)) {