1use strict; 2use warnings; 3 4use Test2::API qw/intercept/; 5use Test::More; 6 7my @values = ( 8 0, # false but defined -> inconsistent 9 0.0, # false but defined -> inconsistent 10 "0.0", # true -> TODO 11 "this is why", # as expected 12); 13 14for my $value (@values) { 15 local $TODO = $value; 16 my $x = defined($value) ? "\"$value\"" : 'UNDEF'; 17 fail "Testing: $x"; 18} 19 20my $e = intercept { 21 local $TODO = ""; 22 fail "Testing: '\"\"'"; 23}; 24 25ok(!$e->[0]->effective_pass, "Test was not TODO when set to \"\""); 26like($e->[1]->message, qr/Failed test '/, "Did not add TODO to the diagnostics"); 27 28done_testing; 29