From 7a4827ab32e5b977db98eb73ebf08872d47ddc72 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 9 Feb 2026 12:56:09 +0100 Subject: [PATCH] Bug 41216: Remove confusion in test output Clearly show the check's description in the test's failure Signed-off-by: Victor Grousset/tuxayo --- xt/author/tt_valid.t | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/xt/author/tt_valid.t b/xt/author/tt_valid.t index 0375deedbfd..eafb30e29c7 100755 --- a/xt/author/tt_valid.t +++ b/xt/author/tt_valid.t @@ -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 -- 2.53.0