use of cn.bran.japid.compiler.JapidAbstractCompiler in project Japid by branaway.
the class CompilerTests method testElvis.
@Test
public void testElvis() throws IOException, ParseException {
String src = readFile("tests/elvis.html");
JapidTemplate bt = new JapidTemplate("tests/elvis.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
String srcCode = bt.javaSource;
System.out.println(srcCode);
}
use of cn.bran.japid.compiler.JapidAbstractCompiler in project Japid by branaway.
the class CompilerTests method testIfindef.
@Test
public void testIfindef() throws IOException, ParseException {
String src = readFile("tests/ifindef.html");
JapidTemplate bt = new JapidTemplate("tests/ifindef.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
String srcCode = bt.javaSource;
// System.out.println(srcCode);
assertTrue(!srcCode.contains("_if"));
}
use of cn.bran.japid.compiler.JapidAbstractCompiler in project Japid by branaway.
the class CompilerTests method testIfCommand.
@Test
public void testIfCommand() throws IOException {
String src = readFile("JapidSample/app/japidviews/Application/ifs.html");
JapidTemplate bt = new JapidTemplate("Application/ifs.html", src);
JapidAbstractCompiler cp = new JapidLayoutCompiler();
cp.compile(bt);
String javaSource = bt.javaSource;
System.out.println(javaSource);
assertTrue(javaSource.contains("if(!asBoolean(ss))"));
assertTrue(javaSource.contains("else if(!asBoolean(ss))"));
assertTrue("invalid java code", JavaSyntaxTool.isValid(javaSource));
}
use of cn.bran.japid.compiler.JapidAbstractCompiler in project Japid by branaway.
the class CompilerTests method testActionInvocation.
@Test
public void testActionInvocation() throws IOException {
String src = readFile("tests/actions.html");
JapidTemplate bt = new JapidTemplate("tests/actions.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
String source = bt.javaSource;
System.out.println(source);
assertTrue("invalid java code", JavaSyntaxTool.isValid(source));
assertTrue(source.contains("MyController.foo()"));
assertTrue(source.contains("MyController.bar()"));
}
Aggregations