Skip to content

Commit

Permalink
Add more tests and make sure we use the lib ./lib before others in ou…
Browse files Browse the repository at this point in the history
…r include path
  • Loading branch information
leto committed Jul 15, 2011
1 parent 61ce072 commit dbc32db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/Algorithm/Soundex.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use v6;
class Algorithm::Soundex {

method soundex ($string --> Str ) {
return '' unless $string;
my $soundex = $string.substr(0,1).uc;
gather {
take $soundex;
Expand Down
8 changes: 5 additions & 3 deletions t/00-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use v6;
use Test;

# because prove -l doesn't work for perl 6 modules
BEGIN { push @*INC, './lib'; }
BEGIN { unshift @*INC, './lib'; }

plan 3;
plan 4;

use Algorithm::Soundex;
pass("Loaded Algorithm::Soundex");
Expand All @@ -14,6 +14,8 @@ my Algorithm::Soundex $s .= new();
isa_ok($s, Algorithm::Soundex);

my $soundex = $s.soundex("Robert");
is($soundex, 'R163', 'soundex of Robert');

is($soundex, 'R163');
$soundex = $s.soundex("");
is($soundex, '', 'soundex of nothing is nothing');

0 comments on commit dbc32db

Please sign in to comment.