Skip to content

Commit

Permalink
Fix a bug in handling $TODO
Browse files Browse the repository at this point in the history
Most places honored a defined but false $TODO setting. One place did not
honor it. This has been corrected.

Fixes #812
  • Loading branch information
exodist committed Dec 11, 2018
1 parent b205fe2 commit 9c269ff
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@
{{$NEXT}}

- Fix #817 (local $TODO bug)
- Fix #812 (Another local $TODO bug)
- Fix #815 (shm read warning)

1.302141 2018-11-30 14:27:19-08:00 America/Los_Angeles
Expand Down
2 changes: 1 addition & 1 deletion lib/Test/Builder.pm
Expand Up @@ -64,7 +64,7 @@ sub _add_ts_hooks {
$todo = ${"$cpkg\::TODO"} if $cpkg;
$todo = ${"$epkg\::TODO"} if $epkg && !$todo;

return $e unless $todo;
return $e unless defined $todo;

# Turn a diag into a todo diag
return Test::Builder::TodoDiag->new(%$e) if ref($e) eq 'Test2::Event::Diag';
Expand Down
21 changes: 21 additions & 0 deletions t/regression/812-todo.t
@@ -0,0 +1,21 @@
use strict;
use warnings;

use Test2::API qw/intercept/;
use Test::More;

my @values = (
"", # false but defined -> inconsistent
0, # false but defined -> inconsistent
0.0, # false but defined -> inconsistent
"0.0", # true -> TODO
"this is why", # as expected
);

for my $value (@values) {
local $TODO = $value;
my $x = defined($value) ? "\"$value\"" : 'UNDEF';
fail "Testing: $x";
}

done_testing;

0 comments on commit 9c269ff

Please sign in to comment.