- the template test bed now works and outputs results to the
test/templates/results directory. Now for a little diff.
PR:
Obtained from:
Submitted by:
Reviewed by:
git-svn-id: https://svn.apache.org/repos/asf/jakarta/velocity/trunk@73422 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/java/org/apache/velocity/test/TemplateTestCase.java b/src/java/org/apache/velocity/test/TemplateTestCase.java
index b341cc6..2a12231 100644
--- a/src/java/org/apache/velocity/test/TemplateTestCase.java
+++ b/src/java/org/apache/velocity/test/TemplateTestCase.java
@@ -70,7 +70,7 @@
* Easily add test cases which evaluate templates and check their output.
*
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
- * @version $Id: TemplateTestCase.java,v 1.4 2000/10/23 20:46:00 jvanzyl Exp $
+ * @version $Id: TemplateTestCase.java,v 1.5 2000/10/23 21:03:52 jvanzyl Exp $
*/
public class TemplateTestCase extends BaseTestCase
{
@@ -85,6 +85,16 @@
private static final String CMP_FILE_EXT = "cmp";
/**
+ * Comparison file extension.
+ */
+ private static final String RESULT_FILE_EXT = "res";
+
+ /**
+ * Results relative to the build directory.
+ */
+ private static final String RESULT_DIR = "../test/templates/results/";
+
+ /**
* The base file name of the template and comparison file (i.e. array for
* array.vm and array.cmp).
*/
@@ -140,9 +150,11 @@
{
try
{
- System.out.println("Testing " + baseFileName + ".vm");
- Template template = Runtime.getTemplate(baseFileName + ".vm");
- template.merge(context, getWriter(System.out));
+ Template template = Runtime.getTemplate(baseFileName + "." + TMPL_FILE_EXT);
+
+ template.merge(context, getWriter(
+ new FileOutputStream(
+ RESULT_DIR + baseFileName + "." + RESULT_FILE_EXT)));
if (!isMatch())
{