File: 06_prototypes.t

package info (click to toggle)
libsub-wrappackages-perl 2.02-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 292 kB
  • sloc: perl: 664; sh: 3; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 589 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl -w

use strict;

my $pre;
my $post;

use Test::More tests => 3;

use lib 't/lib'; use Prototyped;
use Sub::WrapPackages (
    packages => [qw(Prototyped)],
    pre => sub { $pre = \@_; },
    post => sub { $post = \@_; }
);

my @foo = (1,2,3);
my $r = [Prototyped::prototyped(@foo, 'cow')];
is_deeply($r, [ [1, 2, 3], 'cow'], "prototyped subs work right");
is_deeply($pre, [
    'Prototyped::prototyped',
    [1, 2, 3], 'cow'
], "pre gets the right prototype-ish data");
is_deeply($post, [
    'Prototyped::prototyped',
    [1, 2, 3], 'cow'
], "post gets the right data");