File: 024_Namespaces.t

package info (click to toggle)
libpetal-perl 2.23-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,088 kB
  • ctags: 162
  • sloc: perl: 4,738; xml: 726; makefile: 2
file content (49 lines) | stat: -rw-r--r-- 1,348 bytes parent folder | download | duplicates (9)
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
#!/usr/bin/perl
use warnings;
use strict;
use lib ('lib');
use Test::More 'no_plan';
use Petal;

my $template_file = 'namespaces.xml';
$Petal::DISK_CACHE = 0;
$Petal::MEMORY_CACHE = 0;
$Petal::TAINT = 1;
$Petal::BASE_DIR = 't/data';
my $template = new Petal ($template_file);
my $string;


$string = $template->process (
	replace   => 'REPLACE',
	content   => 'CONTENT',
	attribute => 'ATTRIBUTE',
        elements  => [ 'ELEMENT1', 'ELEMENT2', 'ELEMENT3' ],
);

like ($string => qr/REPLACE/);
like ($string => qr/\Q<p>CONTENT<\/p>\E/);
like ($string => qr/\Q<p attribute="ATTRIBUTE">yo<\/p>\E/);
like ($string => qr/\Q<li>ELEMENT1<\/li>\E/);
like ($string => qr/\Q<li>ELEMENT2<\/li>\E/);
like ($string => qr/\Q<li>ELEMENT3<\/li>\E/);
unlike ($string => qr/\Qtal:\E/);
unlike ($string => qr/\Qxmlns:\E/);


$Petal::OUTPUT = "XHTML";
$string = $template->process (
	replace   => 'REPLACE',
	content   => 'CONTENT',
	attribute => 'ATTRIBUTE',
        elements  => [ 'ELEMENT1', 'ELEMENT2', 'ELEMENT3' ],
);

like ($string => qr/REPLACE/);
like ($string => qr/\Q<p>CONTENT<\/p>\E/);
like ($string => qr/\Q<p attribute="ATTRIBUTE">yo<\/p>\E/);
like ($string => qr/\Q<li>ELEMENT1<\/li>\E/);
like ($string => qr/\Q<li>ELEMENT2<\/li>\E/);
like ($string => qr/\Q<li>ELEMENT3<\/li>\E/);
unlike ($string => qr/\Qtal:\E/);
unlike ($string => qr/\Qxmlns:\E/);