1 2use Test::More; 3use Test::LMU; 4 5# The null set should return zero 6my $null_scalar = true {}; 7my @null_list = true {}; 8is($null_scalar, 0, 'true(null) returns undef'); 9is_deeply(\@null_list, [0], 'true(null) returns undef'); 10 11# Normal cases 12my @list = (1 .. 10000); 13is(10000, true { defined } @list); 14is(0, true { not defined } @list); 15is(1, true { $_ == 5000 } @list); 16 17leak_free_ok( 18 true => sub { 19 my $n = true { $_ == 5000 } @list; 20 my $n2 = true { $_ == 5000 } 1 .. 10000; 21 } 22); 23is_dying('true without sub' => sub { &true(42, 4711); }); 24 25done_testing; 26