File: 14ignore_xpath.t

package info (click to toggle)
libxml-semanticdiff-perl 1.00.00-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 232 kB
  • sloc: perl: 535; xml: 532; makefile: 13
file content (39 lines) | stat: -rw-r--r-- 702 bytes parent folder | download | duplicates (2)
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
use strict;
use warnings;

use Test::More tests => 2;

use XML::SemanticDiff;

my $xml1 = <<'EOX';      
<?xml version="1.0"?>
<root>
<el1 el1attr="good"/>
<el2 el2attr="good">Some Text</el2>
</root>
EOX

my $xml2 = <<'EOX';      
<?xml version="1.0"?>
<root>
<el1 el1attr="good"/>
<el2 el2attr="good">Some Text</el2>
<el3/>
</root>
EOX


#TEST
{
	my $diff_simple = XML::SemanticDiff->new();
	my @results = $diff_simple->compare($xml1, $xml2);
	ok(@results, "XMLs are not identical");
}

#TEST
{
	my $diff_ignore = XML::SemanticDiff->new(ignorexpath=>["/root/el3"]);
	my @results = $diff_ignore->compare($xml1, $xml2);
	ok((!@results), "XMLs should count identical if xpath /root/el3 is excluded");
}