use of cn.bran.japid.compiler.JapidAbstractCompiler in project Japid by branaway.
the class CompilerTests method testSetDirective.
@Test
public void testSetDirective() throws IOException {
String srcFile = "tests/setTag.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate("tests/setTag.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
System.out.println(bt.javaSource);
assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
assertTrue(bt.javaSource.contains("@Override protected void message() {"));
assertTrue(bt.javaSource.contains("@Override protected void title() {"));
}
use of cn.bran.japid.compiler.JapidAbstractCompiler in project Japid by branaway.
the class CompilerTests method testOpenIf.
@Test
public void testOpenIf() throws IOException, ParseException {
String src = readFile("tests/openif.html");
JapidTemplate bt = new JapidTemplate("tests/openif.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
String srcCode = bt.javaSource;
System.out.println(srcCode);
CompilationUnit cu = JavaSyntaxTool.parse(srcCode);
}
use of cn.bran.japid.compiler.JapidAbstractCompiler in project Japid by branaway.
the class CompilerTests method testElvisEscape.
@Test
public void testElvisEscape() throws IOException {
String src = "~{ a ?: b}";
JapidTemplate bt = new JapidTemplate("baba.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.JapidAbstractCompiler in project Japid by branaway.
the class CompilerTests method testSwitch.
@Test
public void testSwitch() throws IOException, ParseException {
String src = readFile("tests/switchCase.html");
JapidTemplate bt = new JapidTemplate("tests/switchCase.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
String srcCode = bt.javaSource;
System.out.println(srcCode);
CompilationUnit cu = JavaSyntaxTool.parse(srcCode);
}
use of cn.bran.japid.compiler.JapidAbstractCompiler in project Japid by branaway.
the class CompilerTests method testScriptlineLayout.
@Test
public void testScriptlineLayout() throws IOException {
String srcFile = "JapidSample/app/japidviews/more/MyController/scriptlineLayout.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate("scriptlineLayout.html", src);
JapidAbstractCompiler cp = new JapidLayoutCompiler();
cp.compile(bt);
String code = bt.javaSource;
System.out.println(code);
assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
}
Aggregations