File: strict.t

package info (click to toggle)
libfunction-parameters-perl 2.002005-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 624 kB
  • sloc: perl: 3,945; makefile: 3
file content (25 lines) | stat: -rw-r--r-- 671 bytes parent folder | download | duplicates (2)
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 warnings;
use strict;

use Test::More tests => 10;

use FindBin;

for my $fail (
    map ["$FindBin::Bin/strict_$_->[0].fail", @$_[1 .. $#$_]],
    ['1', qr/"\$z" can't appear after slurpy parameter "\@y\"/],
    ['2', qr/"\$y" can't appear after slurpy parameter "\@x\"/],
    ['3', qr/"\$z" can't appear after slurpy parameter "%y\"/],
    ['4', qr/"\@z" can't appear after slurpy parameter "\@y\"/],
    ['5', qr/Invalid.*rarity/],
) {
    my ($file, $pat) = @$fail;
    $@ = undef;
    my $done = do $file;
    my $exc = $@;
    my $err = $!;

    is $done, undef, "faulty code doesn't load - $file";
    $exc or die "$file: $err" if $err;
    like $exc, $pat;
}