@ -95,5 +95,9 @@ public class CompositeStringExpression implements Expression {
@@ -95,5 +95,9 @@ public class CompositeStringExpression implements Expression {
ex=parser.parseExpression("This is the last odd number in the list: ${listOfNumbersUpToTen.$[#this%2==1]}",TemplateExpressionParsingTests.DEFAULT_TEMPLATE_PARSER_CONTEXT);
assertEquals("This is the last odd number in the list: 9",ex.getValue(TestScenarioCreator.getTestEvaluationContext()));
checkTemplateParsingError("abc${ {}( 'abc'","Missing closing ')' for '(' at position 8");
checkTemplateParsingError("abc${ {}[ 'abc'","Missing closing ']' for '[' at position 8");
checkTemplateParsingError("abc${ {}{ 'abc'","Missing closing '}' for '{' at position 8");
checkTemplateParsingError("abc${ ( 'abc' }","Found closing '}' at position 14 but most recent opening is '(' at position 6");
checkTemplateParsingError("abc${ '... }","Found non terminating string literal starting at position 6");
checkTemplateParsingError("abc${ \"... }","Found non terminating string literal starting at position 6");
checkTemplateParsingError("abc${ ) }","Found closing ')' at position 6 without an opening '('");
checkTemplateParsingError("abc${ ] }","Found closing ']' at position 6 without an opening '['");
checkTemplateParsingError("abc${ } }","No expression defined within delimiter '${}' at character 3");
checkTemplateParsingError("abc$[ } ]",DOLLARSQUARE_TEMPLATE_PARSER_CONTEXT,"Found closing '}' at position 6 without an opening '{'");
checkTemplateParsingError("Hello ${ ( ","No ending suffix '}' for expression starting at character 6: ${ ( ");
checkTemplateParsingError("Hello ${ ( }","Found closing '}' at position 11 but most recent opening is '(' at position 9");
checkTemplateParsing("#{'Unable to render embedded object: File ({#this == 2}'}",hashes,"Unable to render embedded object: File ({#this == 2}");
checkTemplateParsing("This is the last odd number in the list: ${listOfNumbersUpToTen.$[#this%2==1]}",dollars,"This is the last odd number in the list: 9");
checkTemplateParsing("Hello ${'here is a curly bracket }'}",dollars,"Hello here is a curly bracket }");
checkTemplateParsing("He${'${'}llo ${'here is a curly bracket }'}}",dollars,"He${llo here is a curly bracket }}");
@ -111,6 +112,11 @@ public class TemplateExpressionParsingTests extends ExpressionTestCase {
@@ -111,6 +112,11 @@ public class TemplateExpressionParsingTests extends ExpressionTestCase {
// not a useful expression but tests nested expression syntax that clashes with template prefix/suffix
@ -126,10 +132,10 @@ public class TemplateExpressionParsingTests extends ExpressionTestCase {
@@ -126,10 +132,10 @@ public class TemplateExpressionParsingTests extends ExpressionTestCase {
assertEquals("No ending suffix '}' for expression starting at character 6: ${listOfNumbersUpToTen.${#root.listOfNumbersUpToTen.${#this%2==1==3}} world",pe.getMessage());
assertEquals("Found closing '}' at position 74 but most recent opening is '[' at position 30",pe.getMessage());
}
}
@ -139,11 +145,11 @@ public class TemplateExpressionParsingTests extends ExpressionTestCase {
@@ -139,11 +145,11 @@ public class TemplateExpressionParsingTests extends ExpressionTestCase {