Skip to content

Provide explicit undef to indicate TODO condition is not met #30

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions t/extract-version.t
Original file line number Diff line number Diff line change
Expand Up @@ -648,20 +648,20 @@ foreach my $test_case (@modules) {
# We want to ensure we preserve the original, as long as it's legal, so we
# explicitly check the stringified form.
{
local $TODO = !defined($got) && ($test_case->{TODO_code_sub} || $test_case->{TODO_scalar});
local $TODO = !defined($got) && ($test_case->{TODO_code_sub} || $test_case->{TODO_scalar}) || undef;
Copy link
Member

Choose a reason for hiding this comment

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

This is more strict than the original, but if the change is consequential it will result in more tests failing due to a lack of a TODO_* where there should be one, so it should make the problem more apparent. (That is, I think this change is not harmful.)

isa_ok($got, 'version') or $errs++ if defined $expected_version;
}

if (ref($expected_version) eq 'CODE') {
local $TODO = $test_case->{TODO_code_sub};
local $TODO = $test_case->{TODO_code_sub} || undef;
Copy link
Member

Choose a reason for hiding this comment

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

This line shouldn't need to be changed - $test_case->{TODO_code_sub} is never defined-but-false.

ok(
$expected_version->($got),
"case '$test_case->{name}': module version passes match sub"
)
or $errs++;
}
else {
local $TODO = $test_case->{TODO_scalar};
local $TODO = $test_case->{TODO_scalar} || undef;
Copy link
Member

Choose a reason for hiding this comment

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

same as TODO_code_sub.

is(
(defined $got ? "$got" : $got),
$expected_version,
Expand All @@ -673,7 +673,7 @@ foreach my $test_case (@modules) {
}

if (exists $test_case->{all_versions}) {
local $TODO = $test_case->{TODO_all_versions};
local $TODO = $test_case->{TODO_all_versions} || undef;
Copy link
Member

Choose a reason for hiding this comment

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

same as TODO_code_sub.

if (ref($expected_version) eq 'CODE') {
ok(
$test_case->{all_versions}->($pm_info->{versions}),
Expand Down