sub validate_thing { _validate_subtest_wrapper(\&_validate_thing_guts, @_) } | |
sub validate_class { _validate_subtest_wrapper(\&_validate_class_guts, @_) } | |
sub validate_role { _validate_subtest_wrapper(\&_validate_role_guts, @_) } | |
sub _validate_subtest_wrapper { | |
my ($func, $thing, %args) = @_; | |
# note incrementing by 2 because of our upper curried function | |
local $Test::Builder::Level = $Test::Builder::Level + 2; | |
# run tests w/o a subtest wrapper... | |
return $func->($thing => %args) | |
unless $args{-subtest}; | |
# ...or with one. | |
return $tb->subtest(delete $args{-subtest} => sub { $func->($thing => %args) }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment