[MKDoc-commit] [Petal] Test for ${1} problems

bruno at mkdoc.demon.co.uk bruno at mkdoc.demon.co.uk
Fri Mar 11 17:38:26 GMT 2005


Log Message:
-----------
[Petal] Test for ${1} problems

Added Files:
-----------
    Petal/t:
        087_dollar_one.t
    Petal/t/data:
        dollar-one.xml

-------------- next part --------------
--- /dev/null
+++ t/087_dollar_one.t
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use lib ('lib');
+use Test::More 'no_plan';
+use Petal;
+
+$Petal::BASE_DIR = './t/data/';
+$Petal::DISK_CACHE = 0;
+$Petal::MEMORY_CACHE = 0;
+my $template = new Petal ('dollar-one.xml');
+my $string   = $template->process;
+
+like ($string, qr|<a>\$</a>|);
+like ($string, qr|<b>\$\$</b>|);
+like ($string, qr|<c>\$_</c>|);
+
+like ($string, qr|<d></d>|);
+like ($string, qr|<e></e>|);
+
+like ($string, qr|<f>\$@</f>|);
+like ($string, qr|<g>\$1</g>|);
+like ($string, qr|<h>\$\{1\}</h>|);
+
+like ($string, qr|<i>\$\{1 bar\}</i>|);
+like ($string, qr|<j>\$\{1bar\}</j>|);
+like ($string, qr|<k>\$\{1_bar\}</k>|);
--- /dev/null
+++ t/data/dollar-one.xml
@@ -0,0 +1,14 @@
+<body>
+<a>$</a>
+<b>$$</b>
+<c>$_</c>
+<d>$foo</d>
+<e>${foo}</e>
+<f>$@</f>
+<g>$1</g>
+<h>${1}</h>
+<i>${1 bar}</i>
+<j>${1bar}</j>
+<k>${1_bar}</k>
+</body>
+


More information about the MKDoc-commit mailing list