-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undef tests and docs for undef/non-numeric arg handling #54
base: master
Are you sure you want to change the base?
Conversation
local $SIG{__WARN__} = sub { $warning = shift }; | ||
|
||
my $var = dualvar(undef, undef); | ||
like($warning, qr/Use of uninitialized value in subroutine entry/, 'undef arg warning'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't these warnings localised to different languages? Or am I being confused about $!
?
ok( $var == undef, 'Numeric value'); | ||
ok( $var eq undef, 'String value'); | ||
|
||
my $var2 = dualvar(2.2, undef); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want to
undef $warning;
just before each additional test block to ensure that it's not just remaining from the previous
local $SIG{__WARN__} = sub { $warning = shift }; | ||
|
||
my @c = prototype(); | ||
is( scalar @c, 0, 'no arg results in empty list'); # XXX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent whitespacing - probably wants to be
is(scalar @c, 0, 'no arg results in empty list'); # XXX
like($warning, qr/Use of uninitialized value in subroutine prototype/, 'no arg results in undef arg warning'); | ||
undef $warning; | ||
|
||
is( prototype(undef), undef, 'undef arg'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
This PR is for https://rt.cpan.org/Ticket/Display.html?id=121013 and still requires some feedback.