use of com.yahoo.vespa.indexinglanguage.expressions.StatementExpression in project vespa by vespa-engine.
the class ScriptParserTestCase method requireThatScriptParserBacksUpStream.
@Test
public void requireThatScriptParserBacksUpStream() throws ParseException {
ScriptParserContext config = newContext("{ input foo }{ input bar }");
assertEquals(new ScriptExpression(new StatementExpression(new InputExpression("foo"))), ScriptParser.parseScript(config));
assertEquals(new ScriptExpression(new StatementExpression(new InputExpression("bar"))), ScriptParser.parseScript(config));
}
use of com.yahoo.vespa.indexinglanguage.expressions.StatementExpression in project vespa by vespa-engine.
the class ScriptParserTestCase method requireThatStatementParserCanBeInvoked.
@Test
public void requireThatStatementParserCanBeInvoked() throws ParseException {
try {
ScriptParser.parseStatement(newContext("foo"));
} catch (ParseException e) {
assertException(e, "Encountered \" <IDENTIFIER> \"foo \"\" at line 1, column 1.");
}
assertEquals(new StatementExpression(new InputExpression("foo")), ScriptParser.parseStatement(newContext("input foo")));
assertEquals(new StatementExpression(new InputExpression("foo"), new EchoExpression()), ScriptParser.parseStatement(newContext("input foo | echo")));
assertEquals(new StatementExpression(new ScriptExpression(new StatementExpression(new InputExpression("foo")), new StatementExpression(new EchoExpression()))), ScriptParser.parseStatement(newContext("{ input foo; echo }")));
}
Aggregations