Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 1d8d6d838b
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 25 lines (20 sloc) 0.568 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
module TestFiles;
use Test;

sub basename {
    ($*PROGRAM_NAME ~~ m{ '/' (<-[/]>+) $ })[0];
}

our sub run-tests(
Callable $test-block,
Str :$input-dir = "t_files/{basename}.input",
Str :$output-dir = "t_files/{basename}.output",
Int :$tests-per-block = 1,
Int :$add-to-plan = 0
) {
my @files = dir($output-dir);
plan $tests-per-block * @files + $add-to-plan;

for @files -> $filename {
my $in = open("$input-dir/$filename");
my $out = open("$output-dir/$filename");

        $test-block($in, $out, $filename);
    }
}
Something went wrong with that request. Please try again.