public void testPosition() throws IOException { List<TemplateSection> sections = parser.parse("a\nb<%= foo %>d"); assertEquals(new Position(1, 1), sections.get(0).getItems().get(0).getPosition()); assertEquals(new Position(2, 1), sections.get(0).getItems().get(1).getPosition()); assertEquals(new Position(1, 2), sections.get(0).getItems().get(2).getPosition()); assertEquals(new Position(5, 2), sections.get(1).getItems().get(0).getPosition()); assertEquals(new Position(12, 2), sections.get(2).getItems().get(0).getPosition()); }
public void testSimpleScript() throws IOException { assertEquals( Arrays.<TemplateSection>asList( new TemplateSection(SectionType.STRING, "a"), new TemplateSection(SectionType.SCRIPTLET, "b"), new TemplateSection(SectionType.STRING, "c")), parser.parse("a<%b%>c")); }
public void testStartAngleBracketExpression() throws IOException { assertEquals( Arrays.<TemplateSection>asList(new TemplateSection(SectionType.EXPR, "<")), parser.parse("<%=<%>")); }
public void testStartAngleBracketScriplet() throws IOException { assertEquals( Arrays.<TemplateSection>asList(new TemplateSection(SectionType.SCRIPTLET, "<")), parser.parse("<%<%>")); }
public void testPercentExpression() throws IOException { assertEquals( Arrays.<TemplateSection>asList(new TemplateSection(SectionType.EXPR, "%")), parser.parse("<%=%%>")); }
public void testPercentScriplet() throws IOException { assertEquals( Arrays.<TemplateSection>asList(new TemplateSection(SectionType.SCRIPTLET, "%")), parser.parse("<%%%>")); }
public void testSingleEmptyExpression() throws IOException { assertEquals( Arrays.<TemplateSection>asList(new TemplateSection(SectionType.EXPR, "")), parser.parse("<%=%>")); }
public void testText() throws IOException { assertEquals( Arrays.<TemplateSection>asList(new TemplateSection(SectionType.STRING, "a")), parser.parse("a")); }
public void testEmpty() throws IOException { assertEquals(Collections.<TemplateSection>emptyList(), parser.parse("")); }