-
-
Save rsrchboy/08c107475f3c37842747 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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