Update tests for tidy-html 5.8.0 #14 https://github.com/petdance/html-tidy5/pull/14 diff --git a/t/drop-empty-elements.t b/t/drop-empty-elements.t index 531e5fa..b2e83f9 100644 --- a/t/drop-empty-elements.t +++ b/t/drop-empty-elements.t @@ -32,11 +32,14 @@ subtest 'default constructor warns about empty spans' => sub { $tidy->parse( 'test', $html ); messages_are( $tidy, - [ 'test (7:9) Warning: trimming empty ' ], + [ + 'test (4:9) Warning: blank \'title\' element', + 'test (7:9) Warning: trimming empty ' + ], ); }; -subtest 'drop_empty_elements => 1 gives message' => sub { +subtest 'drop_empty_elements => 2 gives message' => sub { plan tests => 2; my $tidy = HTML::Tidy5->new( { drop_empty_elements => 1 } ); @@ -44,7 +47,10 @@ subtest 'drop_empty_elements => 1 gives message' => sub { $tidy->parse( 'test', $html ); messages_are( $tidy, - [ 'test (7:9) Warning: trimming empty ' ], + [ + 'test (4:9) Warning: blank \'title\' element', + 'test (7:9) Warning: trimming empty ' + ], ); }; @@ -55,7 +61,11 @@ subtest 'drop_empty_elements => 0 gives no messages' => sub { isa_ok( $tidy, 'HTML::Tidy5' ); $tidy->parse( 'test', $html ); - messages_are( $tidy, [] ); + messages_are( $tidy, + [ + 'test (4:9) Warning: blank \'title\' element', + ], + ); }; exit 0; diff --git a/t/html_fragment_tidy_ok.t b/t/html_fragment_tidy_ok.t index 15c04ca..1f74faa 100644 --- a/t/html_fragment_tidy_ok.t +++ b/t/html_fragment_tidy_ok.t @@ -44,12 +44,15 @@ HTML test_test( $msg ); $msg = 'html_fragment_tidy_ok can handle it'; - test_out( "ok 1 - $msg" ); + test_out( "not ok 1 - $msg" ); + test_fail( +4 ); + test_diag( "Errors: $msg" ); + test_diag( '(-2:9) Warning: blank \'title\' element' ); + test_diag( '1 message on the page' ); html_fragment_tidy_ok( $html, $msg ); test_test( $msg ); }; - subtest 'html_fragment_tidy_ok gets the same errors as html_tidy_ok' => sub { plan tests => 2; @@ -76,11 +79,12 @@ HTML # Note that the line numbers are the same between html_tidy_ok and html_fragment_tidy_ok. $msg = 'html_fragment_tidy_ok on sloppy doc'; test_out( "not ok 1 - $msg" ); - test_fail( +5 ); + test_fail( +6 ); test_diag( "Errors: $msg" ); test_diag( '(2:59) Warning: discarding unexpected ' ); + test_diag( '(-2:9) Warning: blank \'title\' element' ); test_diag( '(3:5) Warning: lacks "alt" attribute' ); - test_diag( '2 messages on the page' ); + test_diag( '3 messages on the page' ); html_fragment_tidy_ok( $html, $msg ); test_test( $msg ); }; diff --git a/t/html_tidy_ok.t b/t/html_tidy_ok.t index 07cfbfd..d8afd9b 100644 --- a/t/html_tidy_ok.t +++ b/t/html_tidy_ok.t @@ -41,9 +41,19 @@ subtest 'html_tidy_ok without errors' => sub { HTML - test_out( 'ok 1 - Called html_tidy_ok on full document' ); + test_out( 'not ok 1 - Called html_tidy_ok on full document' ); + test_fail( +4 ); + test_diag( "Errors: Called html_tidy_ok on full document" ); + test_diag( '(4:9) Warning: blank \'title\' element' ); + test_diag( '1 message on the page' ); html_tidy_ok( $html, 'Called html_tidy_ok on full document' ); test_test( 'html_tidy_ok on full document works' ); + # > # Failed test 'Called html_tidy_ok on full document' + # > # at t/html_tidy_ok.t line 45. + # > # Errors: Called html_tidy_ok on full document + # > # (4:9) Warning: blank 'title' element + # > # 1 message on the page + }; @@ -95,22 +105,26 @@ HTML # Default html_tidy_ok() complains about empty paragraph. test_out( 'not ok 1 - Empty paragraph' ); - test_fail( +4 ); + test_fail( +5 ); test_diag( 'Errors: Empty paragraph' ); + test_diag( '(4:9) Warning: blank \'title\' element' ); test_diag( '(12:9) Warning: trimming empty

' ); - test_diag( '1 message on the page' ); + test_diag( '2 messages on the page' ); html_tidy_ok( $html, 'Empty paragraph' ); test_test( 'html_tidy_ok works on empty paragraph' ); # Now make our own more relaxed Tidy object and it should pass. my $tidy = HTML::Tidy5->new( { drop_empty_elements => 0 } ); isa_ok( $tidy, 'HTML::Tidy5' ); - test_out( 'ok 1 - Relaxed tidy' ); + test_out( 'not ok 1 - Relaxed tidy' ); + test_fail( +4 ); + test_diag( 'Errors: Relaxed tidy' ); + test_diag( '(4:9) Warning: blank \'title\' element' ); + test_diag( '1 message on the page' ); html_tidy_ok( $tidy, $html, 'Relaxed tidy' ); test_test( 'html_tidy_ok with user-specified tidy works' ); }; - subtest 'Reusing a tidy object' => sub { plan tests => 7; diff --git a/t/new-tags.t b/t/new-tags.t index 9912686..adb2ab5 100644 --- a/t/new-tags.t +++ b/t/new-tags.t @@ -43,6 +43,7 @@ my @all_errors = ( 'test (14:28) Warning: discarding unexpected ', 'test (14:49) Warning: discarding unexpected ', 'test (16:9) Warning: discarding unexpected ', + 'test (4:9) Warning: blank \'title\' element', ); @@ -52,7 +53,6 @@ subtest 'default constructor warns about