-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: optionally tell "ok" module to BAIL_OUT if module cannot be loaded #929
Comments
I think this feature request should be a new module. I do not want to complicate ok.pm with this functionality. I would suggest subclassing https://metacpan.org/pod/Test2::Require::Module in Test2::Require::ModuleOrBail that implements the additional behavior. If you write it as a PR against Test2-Suite I will likely merge it. But it is also perfectly reasonable as a stand alone cpan dist. |
I do this with a subroutine in a module that I share among my tests. Part of that is I want better control of the error reporting, and I already have a utility module for tests to access application specific things they need in a common way. Since I already have that utility module, it's easy to add functions. Typically I have some other checks besides the
These tests may seem overly targeted, but while developing, sometimes a module name changes because I'm an idiot at naming things and often the team comes up with a better name. Along with that, the module name changes but I forget which tests use that name. Sure, Note a drawback I recently had. Things like |
@briandfoy $TODO is essentially deprecated in favor of this from Test2: https://metacpan.org/pod/Test2::Todo it plays nicely with Test::Builder based tools, so you can start using that. Or even the todo() function from https://metacpan.org/pod/Test2::Tools::Basic#$todo-=-todo($reason) Once againm, plays nicely with older tools, and does not suffer from the package variable problem. |
Indeed Test2 does some things better. But, Test2 was only just recently added to core so the old ways will persist for several more years. |
I am looking for a way to replace this idiom
with something that uses the ok module?!
The text was updated successfully, but these errors were encountered: