Bug 41216: Remove confusion in test output

Clearly show the check's description in the test's failure

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2026-02-09 12:56:09 +01:00 committed by Lucas Gass
parent 2597cc8d2b
commit f088e300f8
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 7 additions and 4 deletions

View File

@ -31,7 +31,7 @@ my @exclusions = qw(
);
@tt_files = array_minus @tt_files, @exclusions;
plan tests => scalar(@tt_files) + 1;
plan tests => scalar(@tt_files) * 2 + 1;
my @translatable_attributes = qw(alt content title value label placeholder aria-label);
@ -80,17 +80,20 @@ my $checkers = [
for my $filepath (@tt_files) {
my $parser = C4::TTParser->new;
$parser->build_tokens($filepath);
my @errors;
my $errors = {};
while ( my $token = $parser->next_token ) {
my $attr = $token->{_attr};
next unless $attr;
for my $checker (@$checkers) {
my @e = $checker->{check}->( $checker, $filepath, $token );
push @errors, @e if @e;
push @{ $errors->{ $checker->{description} } }, @e if @e;
}
}
is( scalar(@errors), 0 ) or diag( "$filepath: " . join( ', ', @errors ) );
for my $checker (@$checkers) {
my @errors = @{ $errors->{ $checker->{description} } || [] };
is( scalar(@errors), 0, $checker->{description} ) or diag( "$filepath: " . join( ', ', @errors ) );
}
}
=head1 NAME