Sha256: 54fa28f83cafdb4673dfa5aa93be9b2c3a7a054440594177a46760bb7fb659c5

Contents?: true

Size: 1.9 KB

Versions: 119

Compression:

Stored size: 1.9 KB

Contents

#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;{{#cdata}}
my $dir;{{/cdata}}
use lib{{#cdata}} $dir ={{/cdata}} $FindBin::Bin;{{#lib_comment}} {{&lib_comment}}{{/lib_comment}}{{#cdata}}
use JSON::PP;{{/cdata}}{{#modules}}
use {{&use}};{{/modules}}

my $exercise{{#exercise}} = '{{&exercise}}'{{/exercise}};{{#exercise_comment}} {{&exercise_comment}}{{/exercise_comment}}
my $test_version{{#version}} = {{&version}}{{/version}};{{#version_comment}} {{&version_comment}}{{/version_comment}}
my $module = $ENV{EXERCISM} ? 'Example' : $exercise;{{#module_comment}} {{&module_comment}}{{/module_comment}}
use Test::More{{#plan}} tests => {{&plan}}{{/plan}};{{#plan_comment}} {{&plan_comment}}{{/plan_comment}}

use_ok $module or BAIL_OUT;{{#use_test_comment}} {{&use_test_comment}}{{/use_test_comment}}
{{#version_test_comment}}

{{&version_test_comment}}{{/version_test_comment}}
my $exercise_version = $exercise->VERSION // 0;
if ($exercise_version != $test_version) {
  warn "\nExercise version mismatch. Further tests may fail!"
    . "\n$exercise is v$exercise_version. "
    . "Test is v$test_version.\n";
  BAIL_OUT if $ENV{EXERCISM};
}
{{#subs}}

my %subs;
foreach ( qw({{&subs}}) ) {
  can_ok $exercise, $_;
  $subs{$_} = $exercise->can($_);
}
{{/subs}}{{#cdata}}
my $C_DATA;{{/cdata}}
{{&tests}}
{{#cdata}}{{#cdata_test_comment}}
{{&cdata_test_comment}}{{/cdata_test_comment}}
SKIP: {
  skip '', 1 unless $ENV{EXERCISM};
  is_deeply eval q{
    use Path::Tiny;
    decode_json path("$dir/../../problem-specifications/exercises/".path($dir)->basename.'/canonical-data.json')->realpath->slurp;
  }, $C_DATA, 'canonical-data';
}
{{/cdata}}

done_testing;{{#done_testing_comment}} {{&done_testing_comment}}{{/done_testing_comment}}{{#after_done_testing}}

{{&after_done_testing}}{{/after_done_testing}}{{#cdata}}
{{#INIT_comment}}

{{&INIT_comment}}{{/INIT_comment}}
INIT {
$C_DATA = decode_json <<'EOF';

{{&json}}
EOF
}{{/cdata}}

Version data entries

119 entries across 119 versions & 1 rubygems

Version Path
trackler-2.2.1.64 tracks/perl5/templates/test.mustache
trackler-2.2.1.63 tracks/perl5/templates/test.mustache
trackler-2.2.1.62 tracks/perl5/templates/test.mustache
trackler-2.2.1.61 tracks/perl5/templates/test.mustache
trackler-2.2.1.60 tracks/perl5/templates/test.mustache
trackler-2.2.1.59 tracks/perl5/templates/test.mustache
trackler-2.2.1.58 tracks/perl5/templates/test.mustache
trackler-2.2.1.57 tracks/perl5/templates/test.mustache
trackler-2.2.1.56 tracks/perl5/templates/test.mustache
trackler-2.2.1.55 tracks/perl5/templates/test.mustache
trackler-2.2.1.54 tracks/perl5/templates/test.mustache
trackler-2.2.1.53 tracks/perl5/templates/test.mustache
trackler-2.2.1.52 tracks/perl5/templates/test.mustache
trackler-2.2.1.51 tracks/perl5/templates/test.mustache
trackler-2.2.1.50 tracks/perl5/templates/test.mustache
trackler-2.2.1.49 tracks/perl5/templates/test.mustache
trackler-2.2.1.48 tracks/perl5/templates/test.mustache
trackler-2.2.1.47 tracks/perl5/templates/test.mustache
trackler-2.2.1.46 tracks/perl5/templates/test.mustache
trackler-2.2.1.45 tracks/perl5/templates/test.mustache