Add ARM files
[dh-make-perl] / dev / arm / libhtml-tree-perl / libhtml-tree-perl-3.23 / t / attributes.t
diff --git a/dev/arm/libhtml-tree-perl/libhtml-tree-perl-3.23/t/attributes.t b/dev/arm/libhtml-tree-perl/libhtml-tree-perl-3.23/t/attributes.t
new file mode 100644 (file)
index 0000000..640570f
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+
+# HTML::TreeBuilder invokes HTML::Entities::decode on the contents of
+# HREF attributes.  Some CGI-based sites use lang=en or such for
+# internationalization.  When this parameter is after an ampersand,
+# the resulting &lang is decoded, breaking the link.  "sub" is another
+# popular one.
+
+# Test provided by Rocco Caputo
+
+use warnings;
+use strict;
+
+use Test::More tests => 1;
+use HTML::TreeBuilder;
+
+my $tb = HTML::TreeBuilder->new();
+$tb->parse(
+       "<a href='http://wherever/moo.cgi?xyz=123&lang=en'>Test</a>"
+);
+
+my @links = $tb->look_down( sub { $_[0]->tag eq "a" } );
+my $href = $links[0]->attr("href");
+
+ok($href =~ /lang/, "href should contain 'lang' (is: $href)");
+
+exit;
+