Update: Unfortunately, I am not able to use a sub returning a sub as in#!/usr/bin/perl use warnings; use strict; { package MyPackage; sub method1 { '<?xml version="1.0"?>' } sub method2 { '[?xml version="2.0"?][a][/a]' } } use Test::More; sub my_subtest { like( shift, qr/xml version=/, "XML Document"); # more tests on XML document text here.... } for my $method (qw/method1 method2/) { subtest "Checking $method" => sub { my_subtest(MyPackage->$method) + }; }
sub new_test { my ($test, $method) = @_; return sub { $test->(MyPackage->$method) }; } for my $method (qw/method1 method2/) { subtest "Checking $method", new_test(\&my_subtest, $method); }
I am getting
Type of arg 2 to Test::More::subtest must be sub {} (not subroutine en +try)
In reply to Re^3: Test::More subtest parameters
by choroba
in thread Test::More subtest parameters
by space_monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |