Skip to content

Commit 6840c41

Browse files
committed
test: surpress warning/warnings is called in void context
1 parent 4e558b3 commit 6840c41

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

t/modules/Plugin/SRand.t

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,16 @@ sub intercept_2(&) {
8585
);
8686
ok($CLASS->seed && $CLASS->seed != 1234, "set seed");
8787
is($CLASS->from, 'local date', "set from");
88-
like($warning, $reseed_qr, $reseed_name);
88+
$warning = like($warning, $reseed_qr, $reseed_name);
8989

9090
my $hooks = Test2::API::test2_list_exit_callbacks();
9191
delete $ENV{HARNESS_IS_VERBOSE};
9292
$ENV{HARNESS_ACTIVE} = 1;
93-
warning { $events = intercept { $CLASS->import() } };
94-
warning { $events = intercept { $CLASS->import() } };
93+
$warning = warning { $events = intercept { $CLASS->import() } };
94+
$warning = warning { $events = intercept { $CLASS->import() } };
9595
is(Test2::API::test2_list_exit_callbacks, $hooks + 1, "added hook, but only once");
9696

97-
warning { $CLASS->import(undef) };
97+
$warning = warning { $CLASS->import(undef) };
9898
is($CLASS->seed, 0 , "set seed");
9999
is($CLASS->from, 'import arg', "set from");
100100
}

t/modules/Tools/ClassicCompare.t

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ $line = __LINE__ + 2;
257257
like(
258258
intercept {
259259
local $ENV{TS_TERM_SIZE} = 10000;
260-
main::warning {
260+
$warning = main::warning {
261261
cmp_ok($foo, '&& die', $foo, 'overload exception', 'extra diag')
262262
}
263263
},
@@ -312,12 +312,13 @@ note "cmp_ok() displaying good numbers"; {
312312
}
313313

314314

315+
my $warnings;
315316
note "cmp_ok() displaying bad numbers"; {
316317
my $have = "zero";
317318
my $want = "3point5";
318319
like(
319320
intercept {
320-
warnings { cmp_ok($have, '>', $want) };
321+
$warnings = warnings { cmp_ok($have, '>', $want) };
321322
},
322323
array {
323324
fail_events Ok => sub {

0 commit comments

Comments
 (0)