use of cn.bran.japid.template.JapidTemplate 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.template.JapidTemplate 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.template.JapidTemplate 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));
}
use of cn.bran.japid.template.JapidTemplate in project Japid by branaway.
the class CompilerTests method testOldInvoke.
@Test
public void testOldInvoke() throws IOException {
String srcFile = "JapidSample/app/japidviews/Application/authorPanel2.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);
}
use of cn.bran.japid.template.JapidTemplate in project Japid by branaway.
the class CompilerTests method testDefDirective.
@Test
public void testDefDirective() throws IOException, ParseException {
String srcFile = "JapidSample/app/japidviews/templates/def.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate("japidviews/templates/def.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
// System.out.println(bt.javaSource);
// assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
CompilationUnit cu = JavaSyntaxTool.parse(bt.javaSource);
System.out.println(cu);
assertTrue("method is not declared", JavaSyntaxTool.hasMethod(cu, "foo", "public", "String", null));
assertTrue("method is not declared", JavaSyntaxTool.hasMethod(cu, "foo2", "public", "String", "String"));
assertTrue("method is not declared", JavaSyntaxTool.hasMethod(cu, "bar", "public", "String", null));
// assertTrue("method is never called", JavaSyntaxTool.hasMethodInvocatioin(cu, "title"));
// assertTrue("method is never called", JavaSyntaxTool.hasMethodInvocatioin(cu, "footer"));
// assertTrue(bt.javaSource.contains("@Override protected void message() {"));
// assertTrue(bt.javaSource.contains("@Override protected void title() {"));
}
Aggregations