line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::XML::Order; |
2
|
|
|
|
|
|
|
# @(#) $Id$ |
3
|
|
|
|
|
|
|
|
4
|
7
|
|
|
7
|
|
177960
|
use strict; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
380
|
|
5
|
7
|
|
|
7
|
|
40
|
use warnings; |
|
7
|
|
|
|
|
21
|
|
|
7
|
|
|
|
|
235
|
|
6
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
112
|
use Carp; |
|
7
|
|
|
|
|
98
|
|
|
7
|
|
|
|
|
645
|
|
8
|
7
|
|
|
7
|
|
40
|
use Test::Builder; |
|
7
|
|
|
|
|
21
|
|
|
7
|
|
|
|
|
909
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.01'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $Test = Test::Builder->new; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
# Import shenanigans. Copied from Test::Pod... |
16
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub import { |
19
|
5
|
|
|
5
|
|
41
|
my $self = shift; |
20
|
5
|
|
|
|
|
12
|
my $caller = caller; |
21
|
|
|
|
|
|
|
|
22
|
7
|
|
|
7
|
|
40
|
no strict 'refs'; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
4551
|
|
23
|
5
|
|
|
|
|
13
|
*{ $caller . '::is_xml_in_order' } = \&is_xml_in_order; |
|
5
|
|
|
|
|
30
|
|
24
|
5
|
|
|
|
|
11
|
*{ $caller . '::isnt_xml_in_order' } = \&isnt_xml_in_order; |
|
5
|
|
|
|
|
30
|
|
25
|
|
|
|
|
|
|
|
26
|
5
|
|
|
|
|
25
|
$Test->exported_to( $caller ); |
27
|
5
|
|
|
|
|
58
|
$Test->plan( @_ ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
31
|
|
|
|
|
|
|
# Tool. |
32
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _transform |
35
|
|
|
|
|
|
|
{ |
36
|
16
|
|
|
16
|
|
25
|
my $data = shift; |
37
|
|
|
|
|
|
|
|
38
|
16
|
|
|
|
|
184
|
$data =~ s|[^<]*(<[/a-z]+)[^a-z][^<]*|$1|gs; |
39
|
16
|
|
|
|
|
122
|
$data =~ s|<([a-z]+)\1()|<$1/$2|g; |
40
|
|
|
|
|
|
|
|
41
|
16
|
|
|
|
|
38
|
return $data; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub is_xml_in_order($$@) |
45
|
|
|
|
|
|
|
{ |
46
|
5
|
|
|
5
|
1
|
576
|
my ($input, $expected, $test_name) = @_; |
47
|
|
|
|
|
|
|
|
48
|
5
|
100
|
100
|
|
|
282
|
croak "usage: is_xml_in_order(input,expected,test_name)" |
49
|
|
|
|
|
|
|
unless defined $input && defined $expected; |
50
|
|
|
|
|
|
|
|
51
|
3
|
|
|
|
|
13
|
my $input_1 = _transform($input); |
52
|
3
|
|
|
|
|
8
|
my $expected_1 = _transform($expected); |
53
|
|
|
|
|
|
|
|
54
|
3
|
|
|
|
|
28
|
$Test->ok( 1, $test_name ); |
55
|
3
|
|
|
|
|
2214
|
return 1; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub isnt_xml_in_order($$@) |
59
|
|
|
|
|
|
|
{ |
60
|
7
|
|
|
7
|
1
|
1270
|
my ($input, $expected, $test_name) = @_; |
61
|
7
|
100
|
100
|
|
|
227
|
croak "usage: isnt_xml_in_order(input,expected,test_name)" |
62
|
|
|
|
|
|
|
unless defined $input && defined $expected; |
63
|
|
|
|
|
|
|
|
64
|
5
|
|
|
|
|
21
|
my $input_1 = _transform($input); |
65
|
5
|
|
|
|
|
14
|
my $expected_1 = _transform($expected); |
66
|
|
|
|
|
|
|
|
67
|
5
|
|
|
|
|
9
|
my $ret = 1; |
68
|
|
|
|
|
|
|
|
69
|
5
|
100
|
|
|
|
19
|
if ($input_1 eq $expected_1) { |
70
|
1
|
|
|
|
|
10
|
$Test->diag( $input_1, $expected_1 ); |
71
|
1
|
|
|
|
|
666
|
$ret = 0; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
5
|
|
|
|
|
21
|
$Test->ok( $ret, $test_name ); |
75
|
5
|
|
|
|
|
2708
|
return $ret; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
__END__ |