Dallaylaen has asked for the wisdom of the Perl Monks concerning the following question:
Hello dear esteemed monks,
Let's say I have a block function that checks several conditions and fails loudly if any of those are not met ("loudly" means carp/croak/some callback depending on per-caller settings). The names of conditions themselves follow the conventions of Test::More. This is done so to allow for moving them to a test script after good enough testing environment is available.
So the usage is as follows:
use Runtime::Test::Module; use My::Module; my $foo = My::Module->bloated_untestable_method; complain_if_the_following_does_not_hold { like $foo->{bar}, qr/f?o?r?m?a?t/; can_ok $foo->{baz}, qw(do_this do_that frobnicate); };
My question is: how should such a function be named?
The module already has refute for checking a single condition (stressing the fact that we only can disprove things by testing). It also has a contract block function to save a set of conditions for later execution.
What I could come up with so far:
Also if there is a CPAN module for blocks of multiple runtime assertions I would love to see a link. What I've seen so far is either Test::* stuff, one-at-a-time assertions, or full-blown design by contract frameworks. But maybe I just got my keywords wrong...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Naming a block function to check a group of runtime assertions
by 1nickt (Canon) on Dec 24, 2017 at 23:43 UTC | |
by Dallaylaen (Chaplain) on Dec 25, 2017 at 09:07 UTC |