File: minus.t

package info (click to toggle)
libxml-dom-perl 1.25-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 420 kB
  • ctags: 454
  • sloc: xml: 3,918; perl: 3,411; makefile: 46
file content (48 lines) | stat: -rw-r--r-- 940 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
BEGIN {print "1..2\n";}
END {print "not ok 1\n" unless $loaded;}
use XML::DOM;
$loaded = 1;
print "ok 1\n";

my $test = 1;
sub assert_ok
{
    my $ok = shift;
    print "not " unless $ok;
    ++$test;
    print "ok $test\n";
    $ok;
}

#Test 2

my $str = <<END;
<southpark>
<chef voice-type="bass">
Hello children
</chef>
<children>
Hello Chef
<kenny voice-type="muffled">
Whoowhoo whoo
</kenny>
<cartman ass="fat">
Shut up you loser
</cartman>
<kyle>
Cartman, you fat ass
</kyle>
</children>
</southpark>
END

# This example has attribute names with "-" (non alphanumerics)
# A previous bug caused attributes with non-alphanumeric names to always
# be interpreted as default attribute values. When printing out the document
# they would not be printed, because default attributes aren't printed.
my $parser = new XML::DOM::Parser;
my $doc = $parser->parse ($str);

my $out = $doc->toString;
$out =~ tr/\012/\n/;
assert_ok ($out eq $str);