Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Copy over group-of helper from roast
  • Loading branch information
zoffixznet committed Oct 27, 2018
1 parent e7e91ec commit 84039f9
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions t/packages/Test/Helpers.pm6
@@ -1,6 +1,19 @@
unit module Test::Helpers;
use Test;

sub group-of (
Pair (
Int:D :key($plan),
Pair :value((
Str:D :key($desc),
:value(&tests))))
) is export {
subtest $desc => {
plan $plan;
tests
}
}

sub is-run (
Str() $code, $desc = "$code runs",
Stringy :$in, :@compiler-args, :@args, :$out = '', :$err = '', :$exitcode = 0
Expand Down Expand Up @@ -149,6 +162,28 @@ sub make-temp-dir (Int $chmod? --> IO::Path:D) is export {

=begin pod
=head2 group-of
group-of (Pair (Int:D :key($plan), Pair :value((Str:D :key($desc), :value(&tests)))))
A more concise way to write subtests. Code:
group-of 42 => 'some feature' => {
ok 1;
ok 2;
...
ok 42;
}
Is equivalent to:
subtest 'some feature' => {
plan 42;
ok 1;
ok 2;
...
ok 42;
}
=head2 is-run
sub is-run (
Expand Down

0 comments on commit 84039f9

Please sign in to comment.