line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## ---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
# Copyright (C) 2009 NZ Registry Services |
3
|
|
|
|
|
|
|
## ---------------------------------------------------------------------------- |
4
|
|
|
|
|
|
|
package Test::XML::Compare; |
5
|
|
|
|
|
|
|
$Test::XML::Compare::VERSION = '0.05'; |
6
|
5
|
|
|
5
|
|
22911
|
use 5.006000; |
|
5
|
|
|
|
|
17
|
|
7
|
5
|
|
|
5
|
|
27
|
use base 'Test::Builder::Module'; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
3283
|
|
8
|
5
|
|
|
5
|
|
39044
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
106
|
|
9
|
5
|
|
|
5
|
|
23
|
use warnings; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
140
|
|
10
|
5
|
|
|
5
|
|
4894
|
use XML::LibXML; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Test::Builder; |
12
|
|
|
|
|
|
|
use XML::Compare; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
require Exporter; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our @EXPORT = qw( |
19
|
|
|
|
|
|
|
is_xml_same is_xml_different |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $TEST = Test::Builder->new(); |
23
|
|
|
|
|
|
|
my $PARSER = XML::LibXML->new(); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $has = { |
26
|
|
|
|
|
|
|
localname => { |
27
|
|
|
|
|
|
|
# not Comment, CDATASection |
28
|
|
|
|
|
|
|
'XML::LibXML::Attr' => 1, |
29
|
|
|
|
|
|
|
'XML::LibXML::Element' => 1, |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
namespaceURI => { |
32
|
|
|
|
|
|
|
# not Comment, Text, CDATASection |
33
|
|
|
|
|
|
|
'XML::LibXML::Attr' => 1, |
34
|
|
|
|
|
|
|
'XML::LibXML::Element' => 1, |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
attributes => { |
37
|
|
|
|
|
|
|
# not Attr, Comment, CDATASection |
38
|
|
|
|
|
|
|
'XML::LibXML::Element' => 1, |
39
|
|
|
|
|
|
|
}, |
40
|
|
|
|
|
|
|
value => { |
41
|
|
|
|
|
|
|
# not Element, Comment, CDATASection |
42
|
|
|
|
|
|
|
'XML::LibXML::Attr' => 1, |
43
|
|
|
|
|
|
|
'XML::LibXML::Comment' => 1, |
44
|
|
|
|
|
|
|
}, |
45
|
|
|
|
|
|
|
data => { |
46
|
|
|
|
|
|
|
# not Element, Attr |
47
|
|
|
|
|
|
|
'XML::LibXML::CDATASection' => 1, |
48
|
|
|
|
|
|
|
'XML::LibXML::Comment' => 1, |
49
|
|
|
|
|
|
|
'XML::LibXML::Text' => 1, |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
}; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub import { |
54
|
|
|
|
|
|
|
my $class = shift @_; |
55
|
|
|
|
|
|
|
Test::XML::Compare->export_to_level(1, $class); |
56
|
|
|
|
|
|
|
$TEST->exported_to(caller); |
57
|
|
|
|
|
|
|
$TEST->plan(@_) if @_; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub is_xml_same($$;$) { |
61
|
|
|
|
|
|
|
my ($xml1, $xml2, $msg) = @_; |
62
|
|
|
|
|
|
|
return $TEST->ok(XML::Compare::is_same($xml1, $xml2), $msg); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub is_xml_different($$;$) { |
66
|
|
|
|
|
|
|
my ($xml1, $xml2, $msg) = @_; |
67
|
|
|
|
|
|
|
return $TEST->ok(XML::Compare::is_different($xml1, $xml2), $msg); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
__END__ |