File: 08nonexist_ns.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 (99 lines) | stat: -rw-r--r-- 2,513 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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/perl -w

use strict;
use warnings;

use Test::More tests => 2;

use XML::SemanticDiff;

$SIG{__WARN__} = sub { die $_[0]; };

my $xml1 = <<'EOX';
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE
    html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<title>Create a Great Personal Home Site</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h2 id="books">Books</h2>
<p>
These are my books.
</p>
<h3 id="fiction_books">Fiction books</h3>

<div class="prod">
<div class="head">
<p class="prod_img">
<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/"><img src="images/little_women.jpg" alt="Preview" /></a>
</p>
<p class="prod_title">
<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/">Little Women</a>
</p>
</div>
<div class="desc">
<p>
Little Women by Louisa May Alcott.
</p>
</div>
</div>

<h3 id="computer_books">Computer books</h3>
</body>
</html>
EOX

my $xml2 = <<'EOX';      
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
  <head>
    <title>Create a Great Personal Home Site</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  </head>
  <body>
    <h2 id="books">Books</h2>
    <p>
                    These are my books.
                </p>
    <h3 id="fiction_books">Fiction books</h3>
    <div class="prod">
      <div class="head">
        <p class="prod_img">
          <a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/">
            <img alt="Preview" src="images/little_women.jpg"/>
          </a>
        </p>
        <p class="prod_title">
          <a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/">Little Women</a>
        </p>
      </div>
      <div class="desc">
        <p>
                            Little Women by Louisa May Alcott.
                        </p>
      </div>
    </div>
    <h3 id="computer_books">Computer books</h3>
  </body>
</html>
EOX

my $diff = XML::SemanticDiff->new();

my @results=(qw(Humpty Dumpty sat on a wall));
eval {
@results = $diff->compare($xml1, $xml2);
};

# TEST
is ($@, "", "No exception was thrown");
# TEST
ok ((@results == 0), "XML is OK.");