use of cn.bran.japid.compiler.JapidTemplateCompiler in project Japid by branaway.
the class CompilerTests method testOpenBrace.
@Test
public void testOpenBrace() throws IOException {
String srcFile = "tests/openBrace.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate(srcFile, 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 testSimpleInvoke.
@Test
public void testSimpleInvoke() throws IOException {
String srcFile = "tests/simpleInvoke.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate("simpleInvoke.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("actionRunners.put(getOut().length(), new cn.bran.play.CacheablePlayActionRunner(\"\", MyController.class, \"action\", s + \"2\") {"));
assertTrue(code.contains("MyController.action(s);"));
assertTrue(code.contains("MyController.action(s + \"2\");"));
}
use of cn.bran.japid.compiler.JapidTemplateCompiler in project Japid by branaway.
the class CompilerTests method testActionNotation.
@Test
public void testActionNotation() throws IOException {
String src = readFile("JapidSample/app/japidviews/templates/Actions.html");
JapidTemplate bt = new JapidTemplate("japidviews/templates/Actions.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 testVerbatim.
@Test
public void testVerbatim() throws IOException, ParseException {
String srcFile = "JapidSample/app/japidviews/Application/verbatim.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate("japidviews/Application/verbatim.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
CompilationUnit cu = JavaSyntaxTool.parse(bt.javaSource);
System.out.println(cu);
}
use of cn.bran.japid.compiler.JapidTemplateCompiler in project Japid by branaway.
the class CompilerTests method testDoBodyInDef.
@Test
public void testDoBodyInDef() throws IOException {
String srcFile = "tests/doBodyInDef.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate("doBodyInDef.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
System.out.println(bt.javaSource);
assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
}
Aggregations