Stupid question, but does my snippet above emit a TODO test?
I also rebuilt the like_xpath routine after removing the lines making use of the XPath parser (see below). What output do you get from it?
use strict;
use warnings;
use Carp;
use Test::More;
use Test::Builder;
sub like_xpath {
my ($input, $statement, $test_name) = @_;
die "usage: like_xpath(xml,xpath[,name])"
unless $input && $statement;
my $Test = Test::Builder->new;
my $ok = eval {
# Hardcode a failure
return 0;
};
if ($@) {
$Test->ok( 0, $test_name );
$Test->diag( " Parse Failure: $@" );
return 0;
} else {
ok( $ok, $test_name );
unless ( $ok ) {
diag ( " input: $input" );
diag ( " does not match: $statement" );
}
return $ok;
}
}
plan tests=>1;
TODO: {
local $TODO = 'testing todo block';
like_xpath('<xml-bad/>', '/xml', 'test test');
}