Skip to content

Instantly share code, notes, and snippets.

@AlexDaniel
Created May 11, 2019 03:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexDaniel/1878b6ab1eddc568b6f8e78a7618769d to your computer and use it in GitHub Desktop.
Save AlexDaniel/1878b6ab1eddc568b6f8e78a7618769d to your computer and use it in GitHub Desktop.
use v6;
use Test;
plan 2;
sub group-of (
Pair (
Int:D :key($plan),
Pair :value((
Str:D :key($desc),
:value(&tests))))
) is export {
subtest $desc => {
plan $plan;
tests
}
}
# RT#128098
{
my $proc = run :out, :err, $*EXECUTABLE, '-e',
q/use Test; plan 1; diag 'test message'; ok 1;/;
group-of 2 => 'diag at the start of file shows up in non-verbose prove run' => {
like $proc.out.slurp-rest, /^ '1..1' \s+ 'ok 1 -' \s* $/, 'STDOUT';
like $proc.err.slurp-rest, /'test message'/, 'STDERR';
}
}
{
my $proc = run :out, :err, $*EXECUTABLE, '-e',
q/use Test; plan 1; todo 'meow'; diag 'test message'; ok 1;/;
group-of 3 => 'using diag in the middle of TODO tests does not interfere' => {
my $out = $proc.out.slurp-rest;
like $out, /^ '1..1' \s+ 'ok 1 -' \s* '# TODO'/, 'STDOUT has TODO';
unlike $out, /'test message'/, 'diag message is not in STDOUT';
like $proc.err.slurp-rest, /'test message'/,
'diag message is in STDERR';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment