use of cn.bran.japid.compiler.JapidTemplateCompiler in project Japid by branaway.
the class CompilerTests method testExtendsLayoutWithArgs.
@Test
public void testExtendsLayoutWithArgs() throws IOException {
String src = readFile("JapidSample/app/japidviews/more/Perf/perf.html");
JapidTemplate bt = new JapidTemplate("more/Perf/perf.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
System.out.println(bt.javaSource);
assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
}
use of cn.bran.japid.compiler.JapidTemplateCompiler in project Japid by branaway.
the class CompilerTests method testTagCalls.
@Test
public void testTagCalls() throws IOException {
String srcFile = "tests/tagCalls.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate("tagCalls.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
String code = bt.javaSource;
assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
System.out.println(code);
// assertTrue(code.contains("((tag)(new tag(getOut()).setActionRunners(getActionRunners()))).render(a)"));
assertTrue(code.contains("new tag(tagCalls.this).render"));
// assertTrue(code.contains("((my.tag)(new my.tag(getOut())).setActionRunners(getActionRunners())).render(a, new my.tag.DoBody<String>(){"));
assertTrue(code.contains("new my.tag(tagCalls.this).render"));
}
use of cn.bran.japid.compiler.JapidTemplateCompiler in project Japid by branaway.
the class CompilerTests method testReverse.
@Test
public void testReverse() throws IOException {
String path = "tests/reverse.html";
String src = readFile(path);
JapidTemplate bt = new JapidTemplate(path, src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
String srccode = bt.javaSource;
System.out.println(srccode);
assertTrue("invalid java code", JavaSyntaxTool.isValid(srccode));
assertTrue(srccode.contains("p(lookupStatic(\"/x/y.html\"))"));
assertTrue(srccode.contains("p(lookupStatic(\"/a/b/c.html\"))"));
assertTrue(srccode.contains("p(lookup(\"com.action\", \"ad\"))"));
}
use of cn.bran.japid.compiler.JapidTemplateCompiler in project Japid by branaway.
the class CompilerTests method testOpenIfCommand.
@Test
public void testOpenIfCommand() throws IOException {
String src = readFile("JapidSample/app/japidviews/Application/ifs2.html");
JapidTemplate bt = new JapidTemplate("Application/ifs2.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
System.out.println(bt.javaSource);
assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
}
use of cn.bran.japid.compiler.JapidTemplateCompiler in project Japid by branaway.
the class CompilerTests method testRecursiveTags.
@Test
public void testRecursiveTags() throws IOException {
String srcFile = "tests/recursiveTagging.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate("tests/recursiveTagging.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
String code = bt.javaSource;
System.out.println(code);
assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
assertTrue(code.contains("new recursiveTagging(recursiveTagging.this).render"));
}
Aggregations