File: 07_case.t

package info (click to toggle)
libxml-dt-perl 0.69-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 388 kB
  • sloc: perl: 1,432; xml: 438; makefile: 16
file content (70 lines) | stat: -rw-r--r-- 1,455 bytes parent folder | download | duplicates (5)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/perl
use XML::DT ;
use Test::More tests => 8;
my $filename = "t/07_case.xml";

####

%h1=('-default'   => sub{"<$q></$q>"});
$str = dt($filename,%h1);
$str =~ s/\s//g;
is($str, "<A></A>");


%h1=('-ignorecase' => 1,
     '-default'    => sub{"<$q></$q>"});
$str = dt($filename,%h1);
$str =~ s/\s//g;
is($str, "<a></a>");

####

%h2=('c' => sub{ "<$q></$q>" },
     '-default'   => sub{"<$q>$c</$q>"});
$str = dt($filename,%h2);
$str =~ s/\s//g;
is($str, "<A><b><c></c><c></c></b><b><C>aeiou</C><c></c></b><b><c></c><c></c></b></A>");


%h2=('c' => sub{ "<$q></$q>" },
     '-ignorecase' => 1,
     '-default'   => sub{"<$q>$c</$q>"});
$str = dt($filename,%h2);
$str =~ s/\s//g;
is($str, "<a><b><c></c><c></c></b><b><c></c><c></c></b><b><c></c><c></c></b></a>");

####

%h3=('-ignorecase' => 1,
     '-default'   => sub{"$q:$c"});
$str = dt($filename,%h3);
$str =~ s/\s//g;
is($str, "a:b:c:aeiouc:aeioub:c:aeiouc:aeioub:c:aeiouc:aeiou");


%h3=('-default'   => sub{"$q:$c"});
$str = dt($filename,%h3);
$str =~ s/\s//g;
is($str, "A:b:c:aeiouc:aeioub:C:aeiouc:aeioub:c:aeiouc:aeiou");

####

%h4=('-ignorecase' => 1,
     c => sub{ $v{title} },
     '-default'   => sub{ 
	$v{title} ||="";
        "$v{title}$c" });
$str = dt($filename,%h4);
$str =~ s/\s//g;
is($str, "zbrzbr");


%h4=(c => sub{ $v{title} },
     '-default'   => sub{ 
	$v{title} ||="";
        "$v{title}$c" });
$str = dt($filename,%h4);
$str =~ s/\s//g;
is($str, "zbraeiou");