File: after.pm

package info (click to toggle)
liblist-moreutils-xs-perl 0.430-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,116 kB
  • sloc: perl: 9,038; ansic: 159; makefile: 3
file content (24 lines) | stat: -rw-r--r-- 543 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

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

my @x = after { $_ % 5 == 0 } 1 .. 9;
is_deeply(\@x, [6, 7, 8, 9], "after 5");

@x = after { /foo/ } qw{bar baz};
is_deeply(\@x, [], 'Got the null list');

@x = after { /b/ } qw{bar baz foo };
is_deeply(\@x, [qw{baz foo }], "after /b/");

leak_free_ok(
    after => sub {
        @x = after { /z/ } qw{bar baz foo};
    }
);
is_dying('after without sub' => sub { &after(42, 4711); });

@x = (1, after { /foo/ } qw(abc def));
is_deeply(\@x, [1], "check XS implementation doesn't mess up stack");

done_testing;