Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wchristian
Copy link
Contributor

This PR is for https://rt.cpan.org/Ticket/Display.html?id=121013 and still requires some feedback.

local $SIG{__WARN__} = sub { $warning = shift };

my $var = dualvar(undef, undef);
like($warning, qr/Use of uninitialized value in subroutine entry/, 'undef arg warning');
Copy link
Contributor

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);
Copy link
Contributor

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
Copy link
Contributor

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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants