Skip to content

Commit

Permalink
t/corpus.t: use some Test::More functions rather than if+note+ok
Browse files Browse the repository at this point in the history
For some cases, switch from using an if condition and a note and ok,
just use an ok call but giving the test a name.
  • Loading branch information
haarg authored and khwilliamson committed Jul 17, 2024
1 parent d9bda2a commit a2eaba2
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions t/corpus.t
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,12 @@ foreach my $f (@testfiles) {
undef $p;
};

if($@) {
diag "** Couldn't parse $f:\n $@";
ok 0;
is $@, '', "parsed $f without error" or do {
ok 0;
next;
}
};

ok 1, "OK, parsing $f generated " . length($outstring) . " bytes";
note "generated " . length($outstring) . " bytes";

die "Null outstring?" unless $outstring;

Expand Down Expand Up @@ -116,15 +114,9 @@ foreach my $f (@testfiles) {

$xmlsource =~ s/[\n\r]+/\n/g;
$outstring =~ s/[\n\r]+/\n/g;
if($xmlsource eq $outstring) {
note " (Perfect match to $xml)";
unlink $outfilename if $HACK == 1;
ok 1;
next;
}

diag " $outfilename and $xml don't match!";
print STDERR `diff $xml $outfilename` if $HACK;
ok 0;
ok $xmlsource eq $outstring, "perfect match to $xml" or do {
diag `diff $xml $outfilename` if $HACK;
};

unlink $outfilename if $HACK == 1;
}

0 comments on commit a2eaba2

Please sign in to comment.