tracks/perl6/exercises/clock/clock.t in trackler-2.2.1.49 vs tracks/perl6/exercises/clock/clock.t in trackler-2.2.1.50

- old
+ new

@@ -21,11 +21,11 @@ subtest 'Class methods', { ok ::($exercise).can($_), $_ for <time add-minutes>; } -my $c-data; +my $c-data = from-json $=pod.pop.contents; for @($c-data<cases>) { for @(.<cases>) -> $case { given $case<property> { when 'create' { is ::($exercise).new(hour => $case<hour>, minute => $case<minute>).?time, |$case<expected description>; @@ -46,26 +46,13 @@ } todo 'optional test' unless %*ENV<EXERCISM>; is ::($exercise).new(:0hour,:0minute).?add-minutes(65).?time, '01:05', 'add-minutes method can be chained'; -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": "clock", "version": "1.0.1", "comments": [ "Most languages require constructing a clock with initial values,", @@ -552,9 +539,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> }