Michael G Schwern schrieb am 30.03.2011 um 10:37 (+1100): > (moving this to perl-qa because we decided to retire test-users)
Yeah, I noticed only after sending the mail to the test-users list. > > I like a nice function syntax that doesn't require a lot of > > punctuation. However, if you add a test to your capture block in a > > position other than at the end, you'll have to update all the array > > indices, which is awkward. > > The intention is to mitigate that by making your capture blocks small, > but I hear ya. Good point. > > > > Wouldn't it therefore be better to make a closure over the results > > that maintains the array index for you? > > > > my $checker = make_result_checker $history->results; > > $checker->( { > > is_pass => 0, > > name => "this is that", > > file => $0, > > } ); > > $checker->( { > > … > > } ); > > Took me a moment to understand that. Would this cover your need? > > result_like shift @$results, { > ... > }; That's very good! But does it mess with $history's results directly? Or does $history->result return a shallow copy of the results? > If you like it, could I get you to document the concern and technique > in an EXAMPLES section? > https://github.com/schwern/test-more/blob/Test-Builder2/lib/Test/Builder2/Tester.pm Yes, you could. If you want me to commit directly, my github login is milu71. Else I can send you an email. -- Michael Ludwig