Skip to content

Commit

Permalink
Corrected and unfudged tests. Added proto to multisub example.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwarring committed Jul 20, 2014
1 parent 6811e52 commit 425f65c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 4 additions & 5 deletions integration/advent2009-day12.t
Expand Up @@ -15,13 +15,12 @@ use lib 't/spec/packages';
is lolgreet('Jnthn'), 'O HAI JNTHN', 'Exporting symbols works';
}

#?rakudo skip "Importing symbols by name doesn't work in current Rakudo"
{
eval_lives_ok 'use Fancy::Utilities :shortgreet, :lolgreet;', 'Can import symbols by name';
eval_lives_ok 'use Fancy::Utilities :greet, :lolcat;', 'Can import symbols by name';

use Fancy::Utilities :shortgreet, :lolgreet;
use Fancy::Utilities :greet, :lolcat;
is lolgreet('Tene'), 'O HAI TENE', 'Explicitly importing symbols by name works';
nok nicegreet('Jnthn'), 'Good morning, Jnthn!', 'Cannot use a sub not explicitly imported';
is nicegreet('Jnthn'), 'Good morning, Jnthn!', 'Cannot use a sub not explicitly imported';
}

{
Expand All @@ -31,7 +30,7 @@ use lib 't/spec/packages';
is lolrequest("Cake"), 'I CAN HAZ A CAKE?', 'Can use a sub marked as exported and imported via :ALL';
}

#?rakudo skip "Multi subs aren't imported by default in current Rakudo - is this to spec?"

{
use Fancy::Utilities;
is greet(), 'Hi!', "Multi subs are imported by default - is this to spec?";
Expand Down
2 changes: 2 additions & 0 deletions packages/Fancy/Utilities.pm
Expand Up @@ -14,6 +14,8 @@ module Fancy::Utilities {
sub allgreet() is export {
'hi all';
}

proto greet is export {*};
multi sub greet(Str $who) { return "Good morning, $who!" }
multi sub greet() { return "Hi!" }
}

0 comments on commit 425f65c

Please sign in to comment.