From 9c27fb60afe4719bb1edfe1d6c4f0a4cd9881fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branislav=20Zahradn=C3=ADk?= Date: Sun, 12 Jul 2026 07:47:09 +0200 Subject: [PATCH] Let Test::Builder->skip pass the test name when specified The test name is already recognized and accepted by the context, but it is not currently used. --- lib/Test/Builder.pm | 2 +- t/Legacy/Builder/details.t | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/Test/Builder.pm b/lib/Test/Builder.pm index 78cf58caa..366c01c11 100644 --- a/lib/Test/Builder.pm +++ b/lib/Test/Builder.pm @@ -1086,7 +1086,7 @@ sub skip { } unless $self->{no_log_results}; my $tctx = $ctx->snapshot; - $tctx->skip('', $why); + $tctx->skip($name, $why); return release $ctx, 1; } diff --git a/t/Legacy/Builder/details.t b/t/Legacy/Builder/details.t index f95671ab5..5081ba9a7 100644 --- a/t/Legacy/Builder/details.t +++ b/t/Legacy/Builder/details.t @@ -15,7 +15,7 @@ use Test::More; use Test::Builder; my $Test = Test::Builder->new; -$Test->plan( tests => 9 ); +$Test->plan( tests => 10 ); $Test->level(0); my @Expected_Details; @@ -46,6 +46,7 @@ push @Expected_Details, { 'ok' => 1, reason => 'just testing skip', }; + TODO: { local $TODO = 'i need a todo'; $Test->ok( 0, 'a test to todo!' ); @@ -93,6 +94,19 @@ $Test->is_num( scalar @details, 6, $Test->level(1); is_deeply( \@details, \@Expected_Details ); +{ + SKIP: { + $Test->skip( 'testing skip with message', 'test message' ); + } + + push @Expected_Details, { + ok => 1, + actual_ok => 1, + name => 'test message', + type => 'skip', + reason => 'testing skip with message', + }; +} # This test has to come last because it thrashes the test details. { @@ -103,3 +117,4 @@ is_deeply( \@details, \@Expected_Details ); $Test->current_test($curr_test); $Test->is_num( scalar @details, 4 ); } +