File: 01-parse-proto.t

package info (click to toggle)
libmethod-signatures-simple-perl 1.07-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 156 kB
  • sloc: perl: 141; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 771 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

use strict;
use warnings;

use Test::More tests => 10;

my $mss = 'Method::Signatures::Simple';
use_ok $mss;
my $inst = $mss->new(invocant => '$self');

my @tests = (
    [''               => [ qr'my \$self = shift;'                                   ]],
    ['$class: %opts'  => [ qr'my \$class = shift;', qr'my \(\%opts\) = \@_;'        ]],
    ['@stuff'         => [ qr'my \$self = shift;',  qr'my \(\@stuff\) = \@_;'       ]],
    ['$foo, $bar'     => [ qr'my \$self = shift;',  qr'my \(\$foo, \$bar\) = \@_;'  ]],
    ["$/foo, $/bar$/" => [ qr'my \$self = shift;',  qr'my \(foo,bar\) = \@_;'       ]],
);

for my $t (@tests) {
    my $p = $inst->parse_proto($t->[0]);
    for my $match (@{$t->[1]}) {
        like $p, $match; # , "$t->[0] matches $match";
    }
}