Sha256: 0dc7e79f0b4394b9ba3979e71fa0635a56e8de365a943f61088717530093be78

Contents?: true

Size: 753 Bytes

Versions: 55

Compression:

Stored size: 753 Bytes

Contents

#!/usr/bin/env perl6

use Test;
use JSON::Tiny;

use lib ( my $dir = IO::Path.new($?FILE).parent ).path;

my $module_name = %*ENV<EXERCISM>.so ?? 'Example' !! 'Wordy';
my @potential_module = <p6 pm6 pm>.map:  $module_name ~ '.' ~ *; 

my $module = first { $dir.child($_).e }, |@potential_module
    or die "No file '$module_name.p6' found\n";

require $module <&answer>;

plan 16;

my %cases = from-json $dir.child('cases.json').slurp;

for |%cases<cases> -> %case {
    with %case<expected> {
        is answer(%case<input>), |%case<expected description>
            or diag 'input: ' ~ %case<input>;
    }
    without %case<expected> {
        dies-ok { answer(%case<input>) }, %case<description>
            or diag 'input: ' ~ %case<input>;
    }
}

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
trackler-2.0.6.33 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.32 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.31 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.30 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.29 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.28 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.27 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.26 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.25 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.24 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.23 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.22 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.21 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.20 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.19 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.18 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.17 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.16 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.15 tracks/perl6/exercises/wordy/wordy.t
trackler-2.0.6.14 tracks/perl6/exercises/wordy/wordy.t