File: 35-default-xs-bug.t

package info (click to toggle)
libparams-validate-perl 1.31-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,360 kB
  • sloc: perl: 2,374; makefile: 3
file content (24 lines) | stat: -rw-r--r-- 483 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
use strict;
use warnings;

use Test::More 0.88;

use Params::Validate qw( :all );

default_test();

done_testing();

sub default_test {
    my ( $first, $second ) = validate_pos(
        @_,
        { type => SCALAR, optional => 1 },
        { type => SCALAR, optional => 1, default => 'must be second one' },
    );

    is( $first, undef, 'no default for first parameter' );
    is(
        $second, 'must be second one',
        'default for second parameter is applied'
    );
}