Add ARM files
[dh-make-perl] / dev / arm / libhtml-tree-perl / libhtml-tree-perl-3.23 / t / doctype.t
diff --git a/dev/arm/libhtml-tree-perl/libhtml-tree-perl-3.23/t/doctype.t b/dev/arm/libhtml-tree-perl/libhtml-tree-perl-3.23/t/doctype.t
new file mode 100644 (file)
index 0000000..e3c6968
--- /dev/null
@@ -0,0 +1,48 @@
+#!perl -Tw
+
+use strict;
+use Test::More tests => 5;
+
+BEGIN {
+    use_ok( "HTML::TreeBuilder" );
+}
+
+my $html =<<'EOHTML';
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+</head>
+<body>
+blah blah
+</body>
+</html>
+EOHTML
+
+WITH_DECLARATION: { # Check default state
+    my $tree = HTML::TreeBuilder->new;
+    isa_ok( $tree, "HTML::TreeBuilder" );
+
+    $tree->parse( $html );
+    $tree->eof;
+
+    my @lines = split( "\n", $tree->as_HTML(undef, " ") );
+
+    like( $lines[0], qr/DOCTYPE/, "DOCTYPE is in the first line" );
+}
+
+
+WITHOUT_DECLARATION: {
+    my $tree = HTML::TreeBuilder->new;
+    isa_ok( $tree, "HTML::TreeBuilder" );
+
+    $tree->store_declarations(0);
+
+    $tree->parse( $html );
+    $tree->eof;
+
+    my @lines = split( "\n", $tree->as_HTML(undef, " ") );
+
+    unlike( $lines[0], qr/DOCTYPE/, "DOCTYPE is NOT in the first line" );
+}