Subject: | "default" used for wrong parameter (Params::Validate::validate_pos 1.06 and 1.07) |
Date: | Wed, 06 Mar 2013 10:26:54 +0400 |
To: | bug-params-validate [...] rt.cpan.org |
From: | codejumper [...] codejumper.ru |
Hello,
I've just found a bug in Params::Validate module.
Two optional parameters specified. The second have "default" value.
When both parameters omitted in call, i have default value for first
and "undef" for second.
In this situation i've expected undef for first and default value for
second.
Code sample (test) attached.
with new Perl and latest version of Params::Validate I have:
1..6
perl version is: v5.16.2
Params::Validate version is: 1.07
not ok 1 - 01 no default for first
# Failed test '01 no default for first'
# at 1.pl line 26.
# got: 'must be second one'
# expected: undef
not ok 2 - 01 default for second
# Failed test '01 default for second'
# at 1.pl line 27.
# got: undef
# expected: 'must be second one'
ok 3 - 10 default for first
ok 4 - 10 no default for second
ok 5 - 11 default for first
ok 6 - 11 default for second
# Looks like you failed 2 tests of 6.
Message body is not shown because sender requested not to inline it.