1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#!/usr/bin/perl
use warnings;
use strict;
use lib ('lib');
use Test::More tests => 8;
use Petal;
sub nowarnings {
$Petal::MEMORY_CACHE &&
$Petal::DISK_CACHE
};
$Petal::BASE_DIR = './t/data/include';
$Petal::DISK_CACHE = 0;
$Petal::MEMORY_CACHE = 0;
my $petal = new Petal ('index.xml');
unlike(${$petal->_canonicalize()}, '/World""/', "canonicalise");
like($petal->process, '/__INCLUDED__/', "find marker");
unlike($petal->process, '/__INCLUDED__\s+<\/body>/', "find marker and tag");
like($petal->process, '/Hello, "World"/', "find hello");
{
$Petal::OUTPUT = "XML";
$petal = new Petal ('index_xinclude.xml');
like($petal->process, '/__INCLUDED__/', "MTB - XML find included");
$Petal::OUTPUT = "XHTML";
$petal = new Petal ('index_xinclude.xml');
like($petal->process, '/__INCLUDED__/', "MTB - XHTML find included");
}
$Petal::BASE_DIR = './t/data/include/deep';
eval {
$Petal::OUTPUT = "XML";
$petal = new Petal ('index.xml');
$petal->process;
};
like($@, '/Cannot go above base directory/', "correct error");
$Petal::BASE_DIR = './t/data/include';
{
$Petal::OUTPUT = "XML";
$petal = new Petal ('deep/index.xml');
like($petal->process, '/__INCLUDED__/', "deep find included");
}
1;
__END__
|