use of cn.bran.japid.compiler.JapidAbstractCompiler in project Japid by branaway.
the class CompilerTests method testOpenFor.
@Test
public void testOpenFor() throws IOException {
String src = readFile("tests/openFor.html");
JapidTemplate bt = new JapidTemplate("tests/openFor.html", src);
JapidAbstractCompiler cp = new JapidLayoutCompiler();
cp.compile(bt);
System.out.println(bt.javaSource);
assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
}
use of cn.bran.japid.compiler.JapidAbstractCompiler in project Japid by branaway.
the class CompilerTests method testEachDirective.
@Test
public void testEachDirective() throws IOException {
String srcFile = "tests/eachTag.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate("eachTag.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
System.out.println(bt.javaSource);
assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
assertFalse(bt.javaSource.contains("setActionRunners"));
}
use of cn.bran.japid.compiler.JapidAbstractCompiler in project Japid by branaway.
the class CompilerTests method testLayoutWithArgs.
@Test
public void testLayoutWithArgs() throws IOException {
String src = readFile("JapidSample/app/japidviews/more/Perf/perfmain.html");
JapidTemplate bt = new JapidTemplate("more/Perf/perfmain.html", src);
JapidAbstractCompiler cp = new JapidLayoutCompiler();
cp.compile(bt);
System.out.println(bt.javaSource);
assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
}
use of cn.bran.japid.compiler.JapidAbstractCompiler in project Japid by branaway.
the class CompilerTests method testTagline.
@Test
public void testTagline() throws IOException, ParseException {
String srcFile = "tests/tagline.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate("tagline.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
String code = bt.javaSource;
System.out.println(code);
CompilationUnit cu = JavaSyntaxTool.parse(code);
// System.out.println(cu);
}
use of cn.bran.japid.compiler.JapidAbstractCompiler in project Japid by branaway.
the class CompilerTests method testTagNamedArgsWithBody.
@Test
public void testTagNamedArgsWithBody() throws IOException, ParseException {
String srcFile = "tests/callTagWithBody.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate("tests/callTagWithBody.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
String code = bt.javaSource;
assertTrue("invalid java code", JavaSyntaxTool.isValid(code));
System.out.println(code);
}
Aggregations