http://www.perlmonks.org?node_id=991654

nglenn has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to use Test::XML::XPath, and I need to user Test::More's TODO block. It doesn't seem to work as stated in the Test::More documentation; this doesn't work:

use Test::More; use Test::XML::XPath; plan tests=>1; TODO: { local $TODO = 'testing todo block'; like_xpath('<xml-bad/>', '/xml', 'test test'); }

Running prove with the above test placed in 'test.t' gives the following output, failing the suite instead of passing it:

t\test.t .. t\test.t .. 1/1 # Failed test 'test test' # at C:/strawberry/perl/site/lib/Test/XML/XPath.pm line 55. # input: <xml-bad/> # does not match: /xml # Looks like you failed 1 test of 1. t\test.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests Test Summary Report ------------------- t\test.t (Wstat: 256 Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 1 Files=1, Tests=1, 1 wallclock secs ( 0.19 usr + 0.14 sys = 0.33 CPU +) Result: FAIL

I wanted to try and write/send a patch for the module, but I realized I have no idea what I'm doing :) Looking at the source for Test::More, I do not understand how TODO blocks work. Looking at the source for Test::XML::XPath, I see that it uses Test::Builder and Test::More, but I have no idea how you would have to write the code to make it compliant with Test::More's TODO, TODO_skip, and SKIP blocks. Can anyone explain a) how the block functionality is implemented in Test::More and b) the proper way to write a testing module that preserves this functionality?