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


in reply to Re: Test::More subtest parameters
in thread Test::More subtest parameters

Thanks for the reply...

Your subtest is simply an anonymous routine which does not take any parameters. To properly illustrate what I wanted perhaps the code below will clarify....

my $xml; sub my_subtest { like( $xml, qr/xml version=/, "XML Document"); # more tests on XML document text here.... } $xml = MyPackage::method1(); subtest 'Checking XML from method1' => \&my_subtest; $xml = MyPackage::method2(); subtest 'Checking XML from method2...' => \&my_subtest;
I would like to pass $xml as a variable (plus other test parameters) to the subtest. I think the original fudge poster was close as it looks as though having a "fudge wrapper" is the only way this can be achieved. I did wonder if there was a more direct method or whether subtest passed on additional params to "my_subtest".
If any of my proposed solutions have minor errors, it's because I don't waste my genius on trivial matters. :-P