Skip to content

Commit a2eaba2

Browse files
haargkhwilliamson
authored andcommitted
t/corpus.t: use some Test::More functions rather than if+note+ok
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.
1 parent d9bda2a commit a2eaba2

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

t/corpus.t

+7-15
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,12 @@ foreach my $f (@testfiles) {
8080
undef $p;
8181
};
8282

83-
if($@) {
84-
diag "** Couldn't parse $f:\n $@";
85-
ok 0;
83+
is $@, '', "parsed $f without error" or do {
8684
ok 0;
8785
next;
88-
}
86+
};
8987

90-
ok 1, "OK, parsing $f generated " . length($outstring) . " bytes";
88+
note "generated " . length($outstring) . " bytes";
9189

9290
die "Null outstring?" unless $outstring;
9391

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

117115
$xmlsource =~ s/[\n\r]+/\n/g;
118116
$outstring =~ s/[\n\r]+/\n/g;
119-
if($xmlsource eq $outstring) {
120-
note " (Perfect match to $xml)";
121-
unlink $outfilename if $HACK == 1;
122-
ok 1;
123-
next;
124-
}
125-
126-
diag " $outfilename and $xml don't match!";
127-
print STDERR `diff $xml $outfilename` if $HACK;
128-
ok 0;
117+
ok $xmlsource eq $outstring, "perfect match to $xml" or do {
118+
diag `diff $xml $outfilename` if $HACK;
119+
};
129120

121+
unlink $outfilename if $HACK == 1;
130122
}

0 commit comments

Comments
 (0)