File: 011_incorrect_validation_warning.t

package info (click to toggle)
libpath-router-perl 0.15-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 276 kB
  • sloc: perl: 1,863; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 542 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
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More 1.001013;

use Path::Router;

my $router = Path::Router->new;
{
    my $warning;
    local $SIG{__WARN__} = sub { $warning .= $_[0] };
    $router->add_route(
        '/foo/:bar' => (
            validations => {
                baz => 'Int',
            },
        ),
    );

    like(
        $warning,
        qr+Validation provided for component :baz, but the path /foo/:bar doesn't contain a variable component with that name+,
        "got a warning"
    );
}

done_testing;