tracks/perl6/exercises/word-count/word-count.t in trackler-2.2.1.49 vs tracks/perl6/exercises/word-count/word-count.t in trackler-2.2.1.50
- old
+ new
@@ -19,29 +19,16 @@
bail-out 'Example version must match test version.' if %*ENV<EXERCISM>;
}
require ::($module) <&count-words>;
-my $c-data;
+my $c-data = from-json $=pod.pop.contents;
is-deeply (% = .<input>.&count-words), |.<expected description> for @($c-data<cases>);
-unless %*ENV<EXERCISM> {
- skip-rest 'exercism tests';
- exit;
-}
+=head2 Canonical Data
+=begin code
-subtest 'canonical-data' => {
- (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'), 'match problem-specifications' !!
- flunk 'problem-specifications file not found';
-}
-
-INIT {
-$c-data := from-json q:to/END/;
-
{
"exercise": "word-count",
"version": "1.0.0",
"comments": [
"For each word in the input, count the number of times it appears in the",
@@ -155,9 +142,21 @@
}
}
]
}
-END
+=end code
- $module = 'Example' if %*ENV<EXERCISM>;
+unless %*ENV<EXERCISM> {
+ skip-rest 'exercism tests';
+ exit;
}
+
+subtest 'canonical-data' => {
+ (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'), 'match problem-specifications' !!
+ flunk 'problem-specifications file not found';
+}
+
+INIT { $module = 'Example' if %*ENV<EXERCISM> }