Skip to content

Commit e3d32ae

Browse files
1-1samjkeenan
authored andcommitted
do not use fresh_perl for #18669 TODO tests
This commit updates the #18669 TODO tests to use evals instead of fresh_perl() calls, as fresh_perl() is not actually needed because the behavior being tested does not cause the perl interpreter to crash.
1 parent 9153e0d commit e3d32ae

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

t/run/todo.t

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -355,21 +355,35 @@ TODO: {
355355
TODO: {
356356
local $::TODO = 'GH 18669';
357357

358-
my $results = fresh_perl(<<~'EOF', {});
359-
my $x = { arr => undef };
358+
my $x = { arr => undef };
359+
eval {
360360
push(@{ $x->{ decide } ? $x->{ not_here } : $x->{ new } }, "mana");
361-
print $x->{ new }[0];
362-
EOF
363-
is($?, 0, "No assertion failure; GH 18669");
364-
is($results, 'mana', 'push on non-existent hash entry from ternary autovivifies array ref; GH 18669');
361+
};
362+
unlike(
363+
$@,
364+
qr/Not an ARRAY reference/,
365+
"push on non-existent hash entry does not throw 'Not an ARRAY reference' error; GH 18669"
366+
);
367+
is(
368+
eval { $x->{ new }[0] },
369+
'mana',
370+
'push on non-existent hash entry from ternary autovivifies array ref; GH 18669'
371+
);
365372

366-
$results = fresh_perl(<<~'EOF', {});
367-
my $x = { arr => undef };
373+
my $x = { arr => undef };
374+
eval {
368375
push(@{ $x->{ decide } ? $x->{ not_here } : $x->{ arr } }, "mana");
369-
print $x->{ arr }[0];
370-
EOF
371-
is($?, 0, "No assertion failure; GH 18669");
372-
is($results, 'mana', 'push on undef hash entry from ternary autovivifies array ref; GH 18669');
376+
};
377+
unlike(
378+
$@,
379+
qr/Not an ARRAY reference/,
380+
"push on undef hash entry does not throw 'Not an ARRAY reference' error; GH 18669"
381+
);
382+
is(
383+
eval { $x->{ arr }[0] },
384+
'mana',
385+
'push on undef hash entry from ternary autovivifies array ref; GH 18669'
386+
);
373387

374388
}
375389

0 commit comments

Comments
 (0)