Test-HTML-Content-0.08/ 0000755 0001750 0001750 00000000000 11106611350 014070 5 ustar corion corion Test-HTML-Content-0.08/t/ 0000755 0001750 0001750 00000000000 11106611350 014333 5 ustar corion corion Test-HTML-Content-0.08/t/07-errors.link.t 0000755 0001750 0001750 00000010235 07771616401 017237 0 ustar corion corion # Test script to test the failure modes of Test::HTML::Content use Test::More; use lib 't'; use testlib; BEGIN { eval { require Test::Builder::Tester; Test::Builder::Tester->import; }; if ($@) { plan skip_all => "Test::Builder::Tester required for testing error messages"; } }; sub run { # Test that each exported function fails as documented test_out("not ok 1 - Link failure (no links)"); test_fail(+8); if ($Test::HTML::Content::can_xpath eq 'XML::LibXML') { test_diag("Invalid HTML:",""); } else { test_diag("Expected to find at least one tag(s) matching", " href = http://www.perl.com", "Got none"); }; link_ok("","http://www.perl.com","Link failure (no links)"); test_test("Finding no link works"); test_out("not ok 1 - Link failure (two links that don't match)"); test_fail(+14); if ($Test::HTML::Content::can_xpath eq 'XML::LibXML') { test_diag("Expected to find at least one tag(s) matching", " href = http://www.perl.com", "Got", ' foo', ' Home'); } else { test_diag("Expected to find at least one tag(s) matching", " href = http://www.perl.com", "Got", " ", " "); }; link_ok("fooHome", "http://www.perl.com","Link failure (two links that don't match)"); test_test("Finding no link returns all other links"); test_out("not ok 1 - Link failure (two links shouldn't exist do)"); test_fail(+14); if ($Test::HTML::Content::can_xpath eq 'XML::LibXML') { test_diag("Expected to find no tag(s) matching", " href = (?-xism:.)", "Got", ' foo', ' Home'); } else { test_diag("Expected to find no tag(s) matching", " href = (?-xism:.)", "Got", " ", " "); }; no_link("fooHome", qr".","Link failure (two links shouldn't exist do)"); test_test("Finding a link where one should be returns all other links"); test_out("not ok 1 - Link failure (too few links)"); test_fail(+14); if ($Test::HTML::Content::can_xpath eq 'XML::LibXML') { test_diag("Expected to find exactly 3 tag(s) matching", " href = (?-xism:.)", "Got", ' foo', ' Home'); } else { test_diag("Expected to find exactly 3 tag(s) matching", " href = (?-xism:.)", "Got", " ", " "); }; link_count("fooHome",qr".",3,"Link failure (too few links)"); test_test("Diagnosing too few links works"); test_out("not ok 1 - Link failure (too many links)"); test_fail(+18); if ($Test::HTML::Content::can_xpath eq 'XML::LibXML') { test_diag("Expected to find exactly 3 tag(s) matching", " href = (?-xism:.)", "Got", ' bar', ' .', ' foo', ' Home'); } else { test_diag("Expected to find exactly 3 tag(s) matching", " href = (?-xism:.)", "Got", " ", " ", " ", " "); }; link_count("bar.fooHome",qr".",3,"Link failure (too many links)"); test_test("Diagnosing too many links works"); }; runtests( 5,\&run); Test-HTML-Content-0.08/t/embedded-Test-HTML-Content-XPathExtensions.t 0000644 0001750 0001750 00000002127 07774331127 024465 0 ustar corion corion #!D:\perl\5.8.2\bin\perl.exe -w use Test::More 'no_plan'; package Catch; sub TIEHANDLE { my($class, $var) = @_; return bless { var => $var }, $class; } sub PRINT { my($self) = shift; ${'main::'.$self->{var}} .= join '', @_; } sub OPEN {} # XXX Hackery in case the user redirects sub CLOSE {} # XXX STDERR/STDOUT. This is not the behavior we want. sub READ {} sub READLINE {} sub GETC {} my $Original_File = 'lib\Test\HTML\Content\XPathExtensions.pm'; package main; # pre-5.8.0's warns aren't caught by a tied STDERR. $SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; }; tie *STDOUT, 'Catch', '_STDOUT_' or die $!; tie *STDERR, 'Catch', '_STDERR_' or die $!; undef $main::_STDOUT_; undef $main::_STDERR_; eval q{ my $example = sub { local $^W = 0; #line 58 lib/Test/HTML/Content/XPathExtensions.pm # This module patches the XML::XPath::Function namespace use Test::HTML::Content::XPathExtensions; ; } }; is($@, '', "example from line 58"); undef $main::_STDOUT_; undef $main::_STDERR_; Test-HTML-Content-0.08/t/12-title.t 0000755 0001750 0001750 00000001651 07770273227 016112 0 ustar corion corion use strict; use Test::More tests => 7; BEGIN { use_ok( "Test::HTML::Content" ); }; SKIP: { skip "XML::XPath or XML::LibXML is needed for title testing", 6 unless $Test::HTML::Content::can_xpath; title_ok('
And some other stuff
"; # use Test::HTML::Content; sub run { text_ok($HTML,qr"This is a very lang text."ism,"REs for text work"); text_count($HTML,qr"This is a very lang text.",1,"Counting text elements works"); no_text($HTML, "This is a very long test","Negation works as well"); no_text($HTML, qr"This is a very long test","Negation also works with REs"); text_ok($HTML2,"This is some text.","Complete elements are matched"); text_ok($HTML2,"And some more text.","Complete elements are matched with whitespace at the ends"); text_count($HTML2,qr"text",2,"Counting elements works with REs"); text_count($HTML2,qr"[aA]nd",2,"Counting elements works with REs"); # Now guard against inadverent stringification of REs : #$text =~ s/^\s*(.*?)\s*$/$1/; no_text("[A] simple test",qr"[A] simple test","No stringification of REs in no_text()"); text_count("[A] simple test",qr"[A] simple test",0,"No stringification of REs in text_count()"); text_ok("A simple test",qr"A simple test","Text is not broken up"); }; runtests( 11, \&run ); Test-HTML-Content-0.08/t/09-errors.declaration.t 0000755 0001750 0001750 00000000566 07646345217 020604 0 ustar corion corion # Test script to test the failure modes of Test::HTML::Content use Test::More; eval { require Test::Builder::Tester; Test::Builder::Tester->import; }; if ($@) { plan skip_all => "Test::Builder::Tester required for testing error messages"; } plan tests => 1; use_ok('Test::HTML::Content'); # Test that doctype_ok fails as documented # to be done Test-HTML-Content-0.08/t/01-xpath-query-builder.t 0000755 0001750 0001750 00000001717 07770273341 020702 0 ustar corion corion #!/usr/bin/perl -w use strict; use Test::More; use lib 't'; use testlib; # This test file tests the generation of the XPath queries # The XPath queries have to work for both, XML::XPath # and XML::LibXML, so not all features of XML::XPath # can be used ... my (@cases); BEGIN { @cases=( [ tag => {href => 'http://www.perl.com', alt =>"foo"} => '//tag[@alt = "foo" and @href = "http://www.perl.com"]' ], [ tag => {href => qr'http://', alt =>"foo"} => '//tag[@alt = "foo" and @href]' ], [ tag => {href => qr'http://', alt => undef} => '//tag[not(@alt) and @href]' ], [ tag2 => {href => qr'http://', alt => undef} => '//tag2[not(@alt) and @href]' ], ); # plan( tests => scalar @cases +1 ); }; sub run_case { my ($tag,$attr,$result) = @_; my ($query,$code) = Test::HTML::Content::__build_xpath_query("//".$tag,$attr); is( $query, $result, $query ); }; sub run { for my $case (@cases) { run_case( @$case ); }; }; runtests( scalar @cases, \&run ); Test-HTML-Content-0.08/t/01-internal-api.t 0000755 0001750 0001750 00000022203 07770273227 017346 0 ustar corion corion #!/usr/bin/perl -w use strict; use Test::More; use lib 't'; use testlib; # This test file tests the internal routines of Test::HTML. # The internal routines aren't really intended for public # consumption, but the tests you'll find in here should # document the behaviour enough ... my (%cases_2,%cases_3); my $count; BEGIN { $cases_2{__dwim_compare} = [ "foo" => "bar" => 0, "foo" => "..." => 0, "bar" => "foo" => 0, "bar" => "barra" => 0, "barra" => "bar" => 0, "foo" => qr"bar" => 0, "foo" => qr"..." => 1, "bar" => qr"foo" => 0, "bar" => qr"barra" => 0, "barra" => qr"bar" => 1, "foo" => qr"^oo" => 0, "foo" => qr"oo$" => 1, "FOO" => qr"foo$" => 0, "FOO" => qr"foo$"i => 1, ]; $cases_2{__match_comment} = [ "hidden message" => qr"hidden\s+message" => 1, "FOO" => qr"foo$"i => 1, " FOO" => qr"foo$"i => 1, "FOO " => qr"foo$"i => 0, "FOO " => qr"^foo$"i => 0, " hidden message " => "hidden message" => 1, " hidden message " => "hidden message" => 0, ]; $cases_2{__match_text} = [ "hidden message" => qr"hidden\s+message" => 1, "FOO" => qr"foo$"i => 1, " FOO" => qr"foo$"i => 1, "FOO " => qr"foo$"i => 0, "FOO " => qr"^foo$"i => 0, " hidden message " => "hidden message" => 1, " hidden message " => "hidden message" => 0, ]; $cases_2{__match_declaration} = [ "hidden message" => qr"hidden\s+message" => 1, "FOO" => qr"foo$"i => 1, " FOO" => qr"foo$"i => 1, "FOO " => qr"foo$"i => 0, "FOO " => qr"^foo$"i => 0, " hidden message " => "hidden message" => 1, " hidden message " => "hidden message" => 0, ]; $cases_3{__match} = [ {href => 'http://www.perl.com', alt =>"foo"},{}, "href" => 0, {href => 'http://www.perl.com', alt =>"foo"},{}, "alt" => 0, {href => 'http://www.perl.com', alt =>undef},{alt => "boo"}, "alt" => 0, {href => undef, alt =>"foo"},{href => 'http://www.perl.com'}, "href" => 0, {href => 'http://www.perl.com', alt =>"foo"},{href => 'www.perl.com'}, "href" => 0, {href => 'http://www.perl.com', alt =>"foo"},{href => '.', alt => "foo"}, "href" => 0, {href => 'http://www.perl.com', alt =>"foo"},{href => 'http://www.perl.com'}, "href" => 1, {href => qr'www\.perl\.com'},{href => 'http://www.perl.com', alt =>"foo"}, "href" => 1, {href => qr'.', alt => "foo"},{href => 'http://www.perl.com', alt =>"foo"}, "href" => 1, ]; $count = (18 + 24 + 12); $count += (@{$cases_2{$_}} / 3) for (keys %cases_2); $count += (@{$cases_3{$_}} / 4) for (keys %cases_3); }; sub run_case { my ($count,$methods) = @_; my $method; for $method (sort keys %$methods) { my @cases = @{$methods->{$method}}; while (@cases) { my (@params) = splice @cases, 0, $count; my $outcome = pop @params; my ($visual); ($visual = $method) =~ tr/_/ /; $visual =~ s/^\s*(.*?)\s*$/$1/; no strict 'refs'; cmp_ok("Test::HTML::Content::$method"->(@params), '==',$outcome,"$visual(". join( "=~",@params ).")"); }; }; }; sub run { run_case( 3, \%cases_2 ); run_case( 4, \%cases_3 ); my ($count,$seen); ($count,$seen) = Test::HTML::Content::__count_tags->("foo","a",{href => "http://www.perl.com"}); is($count, 0,"Counting tags 1"); is(@$seen, 0,"Checking possible candidates"); ($count,$seen) = Test::HTML::Content::__count_tags->("Perl","a",{href => "http://www.perl.com"}); is($count, 0,"Counting tags 2"); is(@$seen, 1,"Checking possible candidates"); ($count,$seen) = Test::HTML::Content::__count_tags->("Perl","a",{href => "http://www.perl.com"}); is($count, 0,"Counting tags 3"); is(@$seen, 0,"Checking possible candidates"); ($count,$seen) = Test::HTML::Content::__count_tags->("Perl","a",{href => "http://www.perl.com"}); is($count, 0,"Counting tags 4"); is(@$seen, 0,"Checking possible candidates"); ($count,$seen) = Test::HTML::Content::__count_tags->("Perl","a",{href => "http://www.perl.com"}); is($count, 1,"Counting tags 6"); is(@$seen, 1,"Checking possible candidates"); ($count,$seen) = Test::HTML::Content::__count_tags->("Perl","a",{href => "http://www.perl.com"}); is($count, 1,"Counting tags 7"); is(@$seen, 1,"Checking possible candidates"); ($count,$seen) = Test::HTML::Content::__count_tags->("PerlPerl","a",{href => "http://www.perl.com", alt => undef}); is($count, 1,"Counting tags 8"); is(@$seen, 2,"Checking possible candidates"); ($count,$seen) = Test::HTML::Content::__count_tags->("PerlPerl","a",{href => "http://www.perl.com"}); is($count, 2,"Counting tags 9"); is(@$seen, 2,"Checking possible candidates"); ($count,$seen) = Test::HTML::Content::__count_tags->("Perl","a",{href => "http://www.perl.com"}); is($count, 2,"Counting tags 10"); is(@$seen, 2,"Checking possible candidates"); ($count,$seen) = Test::HTML::Content::__count_comments( "" => "foo" ); is($count,0,"Counting comments 0"); is(@$seen,0,"Counting possible candidates 0"); ($count,$seen) = Test::HTML::Content::__count_comments( "foo" => "foo" ); is($count,0,"Counting comments 1"); is(@$seen,0,"Counting possible candidates 1"); ($count,$seen) = Test::HTML::Content::__count_comments( "" => "foo" ); is($count,1,"Counting comments 2"); is(@$seen,1,"Counting possible candidates 2"); ($count,$seen) = Test::HTML::Content::__count_comments( "" => "foo" ); is($count,0,"Counting comments 3"); is(@$seen,1,"Counting possible candidates 3"); ($count,$seen) = Test::HTML::Content::__count_comments( "" => "foo" ); is($count,0,"Counting comments 4"); is(@$seen,1,"Counting possible candidates 4"); ($count,$seen) = Test::HTML::Content::__count_comments( "" => "foo" ); is($count,0,"Counting comments 5"); is(@$seen,1,"Counting possible candidates 5"); ($count,$seen) = Test::HTML::Content::__count_comments( "" => "foo " ); is($count,1,"Counting comments 6"); is(@$seen,1,"Counting possible candidates 6"); ($count,$seen) = Test::HTML::Content::__count_comments( "" => qr"foo" ); is($count,1,"Counting comments 7"); is(@$seen,1,"Counting possible candidates 7"); ($count,$seen) = Test::HTML::Content::__count_comments( "" => "foo" ); is($count,1,"Counting comments 8"); is(@$seen,1,"Counting possible candidates 8"); ($count,$seen) = Test::HTML::Content::__count_comments( "" => "foo" ); is($count,2,"Counting comments 9"); is(@$seen,2,"Counting possible candidates 9"); ($count,$seen) = Test::HTML::Content::__count_comments( "" => "foo" ); is($count,3,"Counting comments 10"); is(@$seen,3,"Counting possible candidates 10"); ($count,$seen) = Test::HTML::Content::__count_comments( "" => "foo" ); is($count,2,"Counting comments 11"); is(@$seen,3,"Counting possible candidates 11"); ($count,$seen) = Test::HTML::Content::__count_text( "" => "foo" ); is($count,0,"Counting text occurrences 0"); is(@$seen,0,"Counting possible candidates 0"); ($count,$seen) = Test::HTML::Content::__count_text( "foo" => "foo" ); is($count,1,"counting text occurrences 1"); is(@$seen,1,"Counting possible candidates 1"); ($count,$seen) = Test::HTML::Content::__count_text( "" => "foo" ); is($count,0,"counting text occurrences 2"); is(@$seen,0,"Counting possible candidates 2"); # This test disabled, as it is not consistent between XPath and NoXPath... #($count,$seen) = Test::HTML::Content::__count_text( "" => "foo" ); #is($count,0,"counting text occurrences 3"); #is(@$seen,2,"Counting possible candidates 3"); ($count,$seen) = Test::HTML::Content::__count_text( "foo bar" => "foo" ); is($count,1,"counting text occurrences 4"); is(@$seen,2,"Counting possible candidates 4"); ($count,$seen) = Test::HTML::Content::__count_text( "foo" => "foo" ); is($count,0,"counting text occurrences 5"); is(@$seen,3,"Counting possible candidates 5"); ($count,$seen) = Test::HTML::Content::__count_text( "Hello foo World" => qr"foo" ); is($count,1,"Checking RE for text 6"); is(@$seen,1,"Counting possible candidates 6"); }; runtests( $count, \&run ); Test-HTML-Content-0.08/t/03-links.t 0000755 0001750 0001750 00000001460 07770273227 016107 0 ustar corion corion #!/usr/bin/perl -w use strict; use lib 't'; use testlib; sub run { # Tests for links no_link('','http://www.perl.com', "Simple non-existing link"); no_link('http://www.perl.com',"http://www.perl.com", "Plain text gets not interpreted as link"); link_ok('Title',"http://www.perl.com", "A link is found"); link_count('IconTitle',"http://www.perl.com", 2,"A link that appears twice is reported twice"); link_ok('Mail me at some address', 'corion@somewhere.else', "Links are not found if commented out"); }; runtests(5,\&run); Test-HTML-Content-0.08/t/13-xpath-gracefull-errors.t 0000755 0001750 0001750 00000002042 07770273227 021365 0 ustar corion corion # Test script to test the failure modes of Test::HTML::Content use Test::More; use lib 't'; use testlib; eval { require Test::Builder::Tester; Test::Builder::Tester->import; }; if ($@) { plan skip_all => "Test::Builder::Tester required for testing error messages"; } sub run { use_ok('Test::HTML::Content'); SKIP: { { no warnings 'once'; $Test::HTML::Content::can_xpath or skip "XML::XPath or XML::LibXML required", 2; }; my ($tree,$result,$seen); eval { ($result,$seen) = Test::HTML::Content::__count_comments("", "hidden message"); }; is($@,'',"Invalid HTML does not crash the test"); eval { ($tree) = Test::HTML::Content::__get_node_tree("",'//comment()'); }; is($@,'',"Invalid HTML does not crash the test"); # is($tree,undef,"The result of __get_node_tree is undef"); } }; runtests( 3, \&run); Test-HTML-Content-0.08/t/01-fallback-xpath.t 0000755 0001750 0001750 00000001322 07770300065 017632 0 ustar corion corion use strict; use Test::More tests => 4; my $HTML = "dot"; SKIP: { eval { require Test::Without::Module; Test::Without::Module->import( 'XML::LibXML' ); }; skip "Need Test::Without::Module to test the fallback", 4 if $@; use_ok("Test::HTML::Content"); link_ok($HTML,'target',"Finding a link works without XML::LibXML"); my ($result,$args); eval { ($result,$args) = Test::HTML::Content::__count_tags($HTML,'a',{_content=>'dot'}); }; is($@,'',"Missing prerequisites don't let the tests fail"); ok($result eq 'skip' || $result == 1,'Skipped or passed when XML::LibXML is missing') or diag "Expected 'skip' or '1', but got '$result'"; }; Test-HTML-Content-0.08/t/99-unix-text.t 0000755 0001750 0001750 00000001424 07770302101 016733 0 ustar corion corion use Test::More; # Check that all released module files are in # UNIX text format use File::Spec; use File::Find; use strict; my @files; my $blib = File::Spec->catfile(qw(blib lib)); find(\&wanted, grep { -d $_ } ($blib, 'bin', 't', 'lib')); plan tests => scalar @files; foreach my $file (@files) { unix_file_ok($file); } sub wanted { push @files, $File::Find::name if /\.p(l|m|od)$/; } sub unix_file_ok { my ($filename) = @_; local $/; open F, "< $filename" or die "Couldn't open '$filename' : $!\n"; binmode F; my $content =
Home page
1
2
}; test_out("not ok 1 - no XPath results found"); test_fail(+5); test_diag(q{Got}, q{ }, q{1
}, q{2
}); xpath_ok($HTML,'//p[@boo]','//p',"no XPath results found"); test_test("Finding no xpath results where some should be outputs the fallback"); test_out("not ok 1 - no XPath results found"); test_fail(+2); test_diag(q{Got none}); xpath_ok($HTML,'//p[@boo]',"no XPath results found"); test_test("Finding no xpath results (implicit)"); test_out("not ok 1 - no XPath results found"); test_fail(+5); test_diag(q{Got}, q{ }, q{1
}, q{2
}); no_xpath($HTML,'//p[@foo]','//p',"no XPath results found"); test_test("Finding xpath results where none should be outputs the fallback"); test_out("not ok 1 - no XPath results found"); test_fail(+5); test_diag(q{Got}, q{ }, q{1
}, q{2
}); no_xpath($HTML,'//p',"no XPath results found"); test_test("Finding xpath results (implicit fallback)"); test_out("not ok 1 - no XPath results found"); test_fail(+5); test_diag(q{Got}, q{ }, q{1
}, q{2
}); xpath_count($HTML,'//p',4,"no XPath results found"); test_test("Too few hits get reported"); test_out("not ok 1 - no XPath results found"); test_fail(+5); test_diag(q{Got}, q{ }, q{1
}, q{2
}); xpath_count($HTML,'//p',2,"no XPath results found"); test_test("Too many hits get reported"); }; Test-HTML-Content-0.08/t/embedded-Test-HTML-Content-NoXPath.t 0000644 0001750 0001750 00000002127 07774331130 022674 0 ustar corion corion #!D:\perl\5.8.2\bin\perl.exe -w use Test::More 'no_plan'; package Catch; sub TIEHANDLE { my($class, $var) = @_; return bless { var => $var }, $class; } sub PRINT { my($self) = shift; ${'main::'.$self->{var}} .= join '', @_; } sub OPEN {} # XXX Hackery in case the user redirects sub CLOSE {} # XXX STDERR/STDOUT. This is not the behavior we want. sub READ {} sub READLINE {} sub GETC {} my $Original_File = 'lib\Test\HTML\Content\NoXPath.pm'; package main; # pre-5.8.0's warns aren't caught by a tied STDERR. $SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; }; tie *STDOUT, 'Catch', '_STDOUT_' or die $!; tie *STDERR, 'Catch', '_STDERR_' or die $!; undef $main::_STDOUT_; undef $main::_STDERR_; eval q{ my $example = sub { local $^W = 0; #line 195 lib/Test/HTML/Content/NoXPath.pm # This module is implicitly loaded by Test::HTML::Content # if XML::XPath or HTML::Tidy::Simple are unavailable. ; } }; is($@, '', "example from line 195"); undef $main::_STDOUT_; undef $main::_STDERR_; Test-HTML-Content-0.08/t/10-errors.text.t 0000755 0001750 0001750 00000001600 07645654053 017261 0 ustar corion corion # Test script to test the failure modes of Test::HTML::Content use Test::More; eval { require Test::Builder::Tester; Test::Builder::Tester->import; }; if ($@) { plan skip_all => "Test::Builder::Tester required for testing error messages"; } plan tests => 1+1*2; use_ok('Test::HTML::Content'); # Test that each exported function fails as documented sub run_tests { test_out("not ok 1 - Text failure (empty document)"); test_fail(+1); text_ok("","Perl","Text failure (empty document)"); no warnings 'once'; if ($Test::HTML::Content::can_xpath) { test_diag( 'Invalid HTML:', "" ); } else { test_diag( 'No text found at all', "Expected at least one text element like 'Perl'" ); }; test_test("Empty document gets reported"); }; run_tests; require Test::HTML::Content::NoXPath; Test::HTML::Content::NoXPath->install; run_tests; Test-HTML-Content-0.08/t/04-comments.t 0000755 0001750 0001750 00000005134 07770273227 016617 0 ustar corion corion #!/usr/bin/perl -w use strict; use lib 't'; use testlib; sub run { use_ok('Test::HTML::Content'); # Tests for comments comment_ok('Mail me at some address', '(c) 2002 corion@cpan.org', "Comments are found if there"); comment_ok('Mail me at some address', ' (c) 2002 corion@cpan.org', "Whitespace at front"); comment_ok('Mail me at some address', ' (c) 2002 corion@cpan.org ', "Whitespace at front and end"); comment_ok('Mail me at some address', '(c) 2002 corion@cpan.org ', "Whitespace at end"); comment_ok('Mail me at some address', '(c) 2002 corion@cpan.org', "Whitespace at HTML front"); comment_ok('Mail me at some address', '(c) 2002 corion@cpan.org', "Whitespace at HTML end"); comment_ok('Mail me at some address', qr'corion@cpan.org', "RE over comments"); comment_ok('Mail me at foo some address', 'corion@cpan.org', "Comments are found if there"); comment_count('Mail me at foo some address', 'corion@cpan.org',1, "Comments are found if there"); comment_count('Mail me at foo some address', 'corion@cpan.org',2, "Comments are counted correctly"); comment_count('Mail me at foo some address', qr'\@cpan\.org',2, "RE-Comments are counted correctly"); no_comment('Mail me at (c) 2002 corion@cpan.org some address', '(c) 2002 corion@cpan.org', "Comments are not found if not there"); no_comment('Mail me at corion@cpan.org some address', 'corion@cpan.org', "Comments are not found if not there"); no_comment('Mail me at foo some address', qr'\@cpan\.com', "RE-Comments are found correctly"); no_comment('Mail me at foo some address', qr'corion\@[c]pan\.org', "RE-Comments not stringified"); }; runtests( 1+15, \&run ); Test-HTML-Content-0.08/t/05-doctype.t 0000755 0001750 0001750 00000001456 07770273227 016445 0 ustar corion corion #!/usr/bin/perl -w use strict; use lib 't'; use testlib; sub run { use_ok('Test::HTML::Content'); # Tests for comments has_declaration(' ', 'DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"', "Doctype 3.2"); has_declaration(' ', qr'HTML', "Doctype via RE"); has_declaration(' ', qr'DOCTYPE.*?HTML 3\.2',"Doctype via other RE"); no_declaration(' ', qr'DOCTYPE.*?HtML 3\.2',"Doctype via other RE"); }; # Borked javadoc HTML DOCTYPE ... #