[Templates-cvs] cvs commit: Template2/t vmeth.t
cvs@template-toolkit.org
cvs@template-toolkit.org
cvs 06/02/01 09:13:17
Modified: t vmeth.t
Log:
* added tests for scalar.substr
Revision Changes Path
2.23 +24 -1 Template2/t/vmeth.t
Index: vmeth.t
===================================================================
RCS file: /template-toolkit/Template2/t/vmeth.t,v
retrieving revision 2.22
retrieving revision 2.23
diff -u -r2.22 -r2.23
--- vmeth.t 2006/01/30 20:06:54 2.22
+++ vmeth.t 2006/02/01 09:13:17 2.23
@@ -13,7 +13,7 @@
# This is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
-# $Id: vmeth.t,v 2.22 2006/01/30 20:06:54 abw Exp $
+# $Id: vmeth.t,v 2.23 2006/02/01 09:13:17 abw Exp $
#
#========================================================================
@@ -709,3 +709,26 @@
-- expect --
[ foo | bar | ]
+-- test --
+[% text = 'Hello World' -%]
+a: [% text.substr(6) %]!
+b: [% text.substr(0, 5) %]!
+c: [% text.substr(0, 5, 'Goodbye') %]!
+d: [% text %]!
+-- expect --
+a: World!
+b: Hello!
+c: Hello!
+d: Goodbye World!
+
+-- test --
+[% text = 'foo bar baz wiz waz woz' -%]
+a: [% text.substr(4, 3) %]
+b: [% text.substr(12) %]
+c: [% text.substr(0, 11, 'FOO') %]
+d: [% text %]
+-- expect --
+a: bar
+b: wiz waz woz
+c: foo bar baz
+d: FOO wiz waz woz