X-Git-Url: https://git.donarmstrong.com/?p=perltidy.git;a=blobdiff_plain;f=t%2Fsnippets1.t;fp=t%2Fsnippets1.t;h=546cee5384c1f10e4959aa07141741015b9f32e4;hp=68927e328eb75f7fa08d90fcae615bf1815eb4a9;hb=57d829ae0e2c75828f8ecc9c7139579350927dbc;hpb=7f27e55dce5925b2bbe8fcfca64f385e917a52be diff --git a/t/snippets1.t b/t/snippets1.t index 68927e3..546cee5 100644 --- a/t/snippets1.t +++ b/t/snippets1.t @@ -25,7 +25,7 @@ # To locate test #13 you can search for its name or the string '#13' use strict; -use Test; +use Test::More; use Carp; use Perl::Tidy; my $rparams; @@ -450,7 +450,8 @@ ok( ( $obj->name() eq $obj2->name() ) sub is_miniwhile { # check for one-line loop (`foo() while $y--') my $op = shift; return ( - !null($op) and null( $op->sibling ) + !null($op) + and null( $op->sibling ) and $op->ppaddr eq "pp_null" and class($op) eq "UNOP" and ( @@ -534,32 +535,39 @@ foreach my $key ( sort keys %{$rtests} ) { perltidyrc => \$params, argv => '', # for safety; hide any ARGV from perltidy stderr => \$stderr_string, - errorfile => \$errorfile_string, # not used when -se flag is set + errorfile => \$errorfile_string, # not used when -se flag is set ); if ( $err || $stderr_string || $errorfile_string ) { + print STDERR "Error output received for test '$key'\n"; if ($err) { - print STDERR -"This error received calling Perl::Tidy with '$sname' + '$pname'\n"; + print STDERR "An error flag '$err' was returned\n"; ok( !$err ); } if ($stderr_string) { print STDERR "---------------------\n"; print STDERR "<>\n$stderr_string\n"; print STDERR "---------------------\n"; - print STDERR -"This error received calling Perl::Tidy with '$sname' + '$pname'\n"; ok( !$stderr_string ); } if ($errorfile_string) { print STDERR "---------------------\n"; print STDERR "<<.ERR file>>\n$errorfile_string\n"; print STDERR "---------------------\n"; - print STDERR -"This error received calling Perl::Tidy with '$sname' + '$pname'\n"; ok( !$errorfile_string ); } } else { - ok( $output, $expect ); + if ( !is( $output, $expect, $key ) ) { + my $leno = length($output); + my $lene = length($expect); + if ( $leno == $lene ) { + print STDERR +"#> Test '$key' gave unexpected output. Strings differ but both have length $leno\n"; + } + else { + print STDERR +"#> Test '$key' gave unexpected output. String lengths differ: output=$leno, expected=$lene\n"; + } + } } }