in reply to Test::More subtest parameters

How do I pass parameters to the subtest?

I kinda think, if you think you need to do that, you're doing it wrong -- but you could do it

sub fudge { my( $name , $cb , $asbestos, @rest ) = @_; subtest $name, sub { $cb->($asbestos, @rest ); }; }

?Maybe (probably not) subtest itself has a syntax for doing this  subtest $name, $callback, @args; ?

FWIW, I've never seen subtest in the wild, and I've seen a lot of tests

Replies are listed 'Best First'.
Re^2: Test::More subtest parameters
by tobyink (Canon) on Apr 17, 2013 at 10:23 UTC

    I do something fairly similar to that here.

    I use subtest from time to time, but not very often.

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name