jvanzyl 01/08/30 07:15:40
Modified: test/texen/templates Control.vm
Added: test/texen/templates book.vm test.props
Log:
- adding property tests
Revision Changes Path
1.3 +14 -0 jakarta-velocity/test/texen/templates/Control.vm
Index: Control.vm
===================================================================
RCS file: /home/cvs/jakarta-velocity/test/texen/templates/Control.vm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Control.vm 2001/03/23 17:37:57 1.2
+++ Control.vm 2001/08/30 14:15:40 1.3
@@ -9,3 +9,17 @@
#set ( $sourceFile = "Test.txt" )
$generator.parse("Test.vm",$sourceFile)
+
+#set ( $props = $properties.load("test.props") )
+
+## This is to test a properties file that was once taken from
+## the file system but is now taken from a JAR. We have to
+## deprecate the use of $generator.TemplatePath if we want
+## templates to work the same way from JARs and the file
+## system. I have a hack in PropsUtil right now to deal
+## with it.
+
+#set ( $props2 = $properties.load("$generator.TemplatePath/test.props") )
+$generator.TemplatePath/test.props
+#set ( $sourceFile = "book.txt" )
+$generator.parse("book.vm",$sourceFile)
1.1 jakarta-velocity/test/texen/templates/book.vm
Index: book.vm
===================================================================
This is the book of the week:
Props retrieved using new method:
Title: $props.get("title")
Author: $props.get("author")
Publisher: $props.get("publisher")
ISBN: $props.get("isbn")
Props retrieved using old method:
Title: $props2.get("title")
Author: $props2.get("author")
Publisher: $props2.get("publisher")
ISBN: $props2.get("isbn")
1.1 jakarta-velocity/test/texen/templates/test.props
Index: test.props
===================================================================
author = Edward O. Wilson
title = Consilience: The Unity of Knowledge
publisher = Knopf
isbn = 0965058305