Test blocks are not run immedietly, they will be run when the done_testing() function is called.
You can run a specific codeblock using the $T2_WORKFLOW variable, which takes either a name or a line number.
Parameter | Default | Description |
---|---|---|
flat | 0 | Do not render block as a subtest |
todo | undef | Mark entire block as TODO |
skip | undef | Do not run the block, generate skip event |
iso | 0 | Isolate test by forking or spawning a new thread |
async | 0 | Test can be run concurrently (but does not have to be) |
You can combine any number of these at once.
Test2::Tools::Spec is smart with Test2::Tools::Mock. It treats a mock in void context as a before_each (roughly).
Test2::Plugin::SpecDeclare provides nice syntax sugar: