File: false.pm

package info (click to toggle)
liblist-moreutils-perl 0.430-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,228 kB
  • sloc: perl: 13,167; makefile: 17
file content (25 lines) | stat: -rw-r--r-- 596 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

use Test::More;
use Test::LMU;

# The null set should return zero
my $null_scalar = false {};
my @null_list   = false {};
is($null_scalar, 0, 'false(null) returns undef');
is_deeply(\@null_list, [0], 'false(null) returns undef');

# Normal cases
my @list = (1 .. 10000);
is(10000, false { not defined } @list);
is(0,     false { defined } @list);
is(1,     false { $_ > 1 } @list);

leak_free_ok(
    false => sub {
        my $n  = false { $_ == 5000 } @list;
        my $n2 = false { $_ == 5000 } 1 .. 10000;
    }
);
is_dying('false without sub' => sub { &false(42, 4711); });

done_testing;