<commit_before>#!/usr/bin/env perl6
use v6;{{=#`{{ }}=}}#`{{! Mustache tags double up as Perl 6 embedded comments}}
use Test;
use lib #`{{#cdata}}my $dir = #`{{/cdata}}$?FILE.IO.dirname;#`{{#lib_comment}} #`[#`{{&lib_comment}}]#`{{/lib_comment}}#`{{#cdata}}
use JSON::Fast;#`{{/cdata}}#`{{#modules}}
use #`{{&use}};#`{{/modules}}

my Str:D $exercise#`{{#exercise}} := '#`{{&exercise}}'#`{{/exercise}};#`{{#exercise_comment}} #`[#`{{&exercise_comment}}]#`{{/exercise_comment}}
my Version:D $version#`{{#version}} = v#`{{&version}}#`{{/version}};#`{{#version_comment}} #`[#`{{&version_comment}}]#`{{/version_comment}}
my Str $module //= $exercise;#`{{#module_comment}} #`[#`{{&module_comment}}]#`{{/module_comment}}#`{{#plan}}
#`{{#cdata}}INIT {
  #`{{/cdata}}plan #`{{&plan}};#`{{#plan_comment}} #`[#`{{&plan_comment}}]#`{{/plan_comment}}#`{{#cdata}}
}#`{{/cdata}}#`{{/plan}}
#`{{#use_test_comment}}

#`[#`{{&use_test_comment}}]#`{{/use_test_comment}}
use-ok $module or bail-out;
require ::($module);
#`{{#version_test_comment}}

#`[#`{{&version_test_comment}}]#`{{/version_test_comment}}
if ::($exercise).^ver !~~ $version {
  warn "\nExercise version mismatch. Further tests may fail!"
    ~ "\n$exercise is $(::($exercise).^ver.gist). "
    ~ "Test is $($version.gist).\n";
  bail-out 'Example version must match test version.' if %*ENV<EXERCISM>;
}
#`{{#imports}}#`{{#imports_comment}}
#`[#`{{&imports_comment}}]#`{{/imports_comment}}
require ::($module) <#`{{&imports}}>;
#`{{/imports}}#`{{#methods}}#`{{#methods_comment}}
#`[#`{{&methods_comment}}]#`{{/methods_comment}}
subtest 'Class methods', {
  ok ::($exercise).can($_), $_ for <#`{{&methods}}>;
}
#`{{/methods}}#`{{#cdata}}
my $c-data;#`{{/cdata}}
#`{{&tests}}

done-testing;#`{{#done_testing_comment}} #`[#`{{&done_testing_comment}}]#`{{/done_testing_comment}}#`{{#after_done_testing}}

#`{{&after_done_testing}}#`{{/after_done_testing}}
#`{{#INIT_comment}}

#`[#`{{&INIT_comment}}]#`{{/INIT_comment}}
INIT {
#`{{#cdata}}$c-data := from-json q:to/END/;

#`{{&json}}
END

#`{{/cdata}}  if %*ENV<EXERCISM> {#`{{#exercism_comment}}
#`[#`{{&exercism_comment}}]#`{{/exercism_comment}}
    $module = 'Example';#`{{#cdata}}
    if (my $c-data-file =
      "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json"
      .IO.resolve) ~~ :f
    {
      is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'canonical-data';
    }
    else {
      flunk 'canonical-data';
    }
  }
  else {
    skip;#`{{/cdata}}
  }
}
<commit_msg>Remove done-testing from test template<commit_after>#!/usr/bin/env perl6
use v6;{{=#`{{ }}=}}#`{{! Mustache tags double up as Perl 6 embedded comments}}
use Test;
use lib #`{{#cdata}}my $dir = #`{{/cdata}}$?FILE.IO.dirname;#`{{#lib_comment}} #`[#`{{&lib_comment}}]#`{{/lib_comment}}#`{{#cdata}}
use JSON::Fast;#`{{/cdata}}#`{{#modules}}
use #`{{&use}};#`{{/modules}}

my Str:D $exercise#`{{#exercise}} := '#`{{&exercise}}'#`{{/exercise}};#`{{#exercise_comment}} #`[#`{{&exercise_comment}}]#`{{/exercise_comment}}
my Version:D $version#`{{#version}} = v#`{{&version}}#`{{/version}};#`{{#version_comment}} #`[#`{{&version_comment}}]#`{{/version_comment}}
my Str $module //= $exercise;#`{{#module_comment}} #`[#`{{&module_comment}}]#`{{/module_comment}}#`{{#plan}}
#`{{#cdata}}INIT {
  #`{{/cdata}}plan #`{{&plan}};#`{{#plan_comment}} #`[#`{{&plan_comment}}]#`{{/plan_comment}}#`{{#cdata}}
}#`{{/cdata}}#`{{/plan}}
#`{{#use_test_comment}}

#`[#`{{&use_test_comment}}]#`{{/use_test_comment}}
use-ok $module or bail-out;
require ::($module);
#`{{#version_test_comment}}

#`[#`{{&version_test_comment}}]#`{{/version_test_comment}}
if ::($exercise).^ver !~~ $version {
  warn "\nExercise version mismatch. Further tests may fail!"
    ~ "\n$exercise is $(::($exercise).^ver.gist). "
    ~ "Test is $($version.gist).\n";
  bail-out 'Example version must match test version.' if %*ENV<EXERCISM>;
}
#`{{#imports}}#`{{#imports_comment}}
#`[#`{{&imports_comment}}]#`{{/imports_comment}}
require ::($module) <#`{{&imports}}>;
#`{{/imports}}#`{{#methods}}#`{{#methods_comment}}
#`[#`{{&methods_comment}}]#`{{/methods_comment}}
subtest 'Class methods', {
  ok ::($exercise).can($_), $_ for <#`{{&methods}}>;
}
#`{{/methods}}#`{{#cdata}}
my $c-data;#`{{/cdata}}
#`{{&tests}}
#`{{#INIT_comment}}

#`[#`{{&INIT_comment}}]#`{{/INIT_comment}}
INIT {
#`{{#cdata}}$c-data := from-json q:to/END/;

#`{{&json}}
END

#`{{/cdata}}  if %*ENV<EXERCISM> {#`{{#exercism_comment}}
#`[#`{{&exercism_comment}}]#`{{/exercism_comment}}
    $module = 'Example';#`{{#cdata}}
    if (my $c-data-file =
      "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json"
      .IO.resolve) ~~ :f
    {
      is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'canonical-data';
    }
    else {
      flunk 'canonical-data';
    }
  }
  else {
    skip;#`{{/cdata}}
  }
}

{'fraction_non_alphanumeric': 0.31752197914536906, 'fraction_numerical': 0.0012267429973420569, 'mean_word_length': 6.526153846153846, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '480162', 'n_tokens_mistral': 2109, 'n_tokens_neox': 2058, 'n_words': 267}