Add ARM files
[dh-make-perl] / dev / arm / libhtml-parser-perl / libhtml-parser-perl-3.56 / t / linkextor-rel.t
diff --git a/dev/arm/libhtml-parser-perl/libhtml-parser-perl-3.56/t/linkextor-rel.t b/dev/arm/libhtml-parser-perl/libhtml-parser-perl-3.56/t/linkextor-rel.t
new file mode 100644 (file)
index 0000000..1190a96
--- /dev/null
@@ -0,0 +1,36 @@
+use Test::More tests => 4;
+
+require HTML::LinkExtor;
+
+$HTML = <<HTML;
+<head>
+<base href="http://www.sn.no/">
+</head>
+<body background="http://www.sn.no/sn.gif">
+
+This is <A HREF="link.html">link</a> and an <img SRC="img.jpg"
+lowsrc="img.gif" alt="Image">.
+HTML
+
+
+# Try the callback interface
+$links = "";
+$p = HTML::LinkExtor->new(
+  sub {
+      my($tag, %links) = @_;
+      #diag "$tag @{[%links]}";
+      $links .= "$tag @{[%links]}\n";
+  });
+
+$p->parse($HTML); $p->eof;
+
+ok($links =~ m|^base href http://www\.sn\.no/$|m);
+ok($links =~ m|^body background http://www\.sn\.no/sn\.gif$|m);
+ok($links =~ m|^a href link\.html$|m);
+
+# Used to be problems when using the links method on a document with
+# no links it it.  This is a test to prove that it works.
+$p = new HTML::LinkExtor;
+$p->parse("this is a document with no links"); $p->eof;
+@a = $p->links;
+is(@a, 0);