File: 23_largeargs.t

package info (click to toggle)
libdata-util-perl 0.67-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 556 kB
  • sloc: perl: 2,958; ansic: 416; makefile: 8
file content (33 lines) | stat: -rw-r--r-- 726 bytes parent folder | download | duplicates (5)
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
26
27
28
29
30
31
32
33
#!perl -w

use strict;
use Test::More tests => 6;

use Data::Util qw(:all);

sub foo{ @_ }

my @tags;
sub before{ push @tags, 'before' . scalar @_; }
sub around{ push @tags, 'around' . scalar @_; my $next = shift; $next->(@_) }
sub after { push @tags, 'after'  . scalar @_; }

my $w = modify_subroutine \&foo,
	before => [\&before],
	around => [\&around],
	after  => [\&after],
;


@tags = ();
is_deeply [$w->(1 .. 10)], [1 .. 10];
is_deeply \@tags, [qw(before10 around11 after10)]
	or diag "[@tags]";

@tags = ();
is_deeply [$w->(1 .. 1000)], [1 .. 1000];
is_deeply \@tags, [qw(before1000 around1001 after1000)];

@tags = ();
is_deeply [$w->(1 .. 5000)], [1 .. 5000];
is_deeply \@tags, [qw(before5000 around5001 after5000)];