tracks/perl5/exercises/phone-number/phone-number.t in trackler-2.2.1.131 vs tracks/perl5/exercises/phone-number/phone-number.t in trackler-2.2.1.132

- old
+ new

@@ -1,34 +1,29 @@ #!/usr/bin/env perl use strict; use warnings; +use JSON::PP; use FindBin; use lib $FindBin::Bin; -use JSON::PP; +use PhoneNumber qw(clean_number); my $exercise = 'PhoneNumber'; -my $test_version = 3; -use Test::More tests => 16; +my $test_version = 4; +use Test::More tests => 15; -use_ok $exercise or BAIL_OUT; - 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}; } -my %subs; -foreach ( qw(clean_number) ) { - can_ok $exercise, $_; - $subs{$_} = $exercise->can($_); -} +can_ok $exercise, 'import' or BAIL_OUT 'Cannot import subroutines from module'; my $C_DATA = do { local $/; decode_json(<DATA>); }; foreach my $subcases (@{$C_DATA->{cases}}) { - is $subs{clean_number}->($_->{input}{phrase}), $_->{expected}, $_->{description} foreach @{$subcases->{cases}}; + is clean_number($_->{input}{phrase}), $_->{expected}, $_->{description} foreach @{$subcases->{cases}}; } __DATA__ { "exercise": "phone-number",