Skip to content

Commit

Permalink
Add test for "is cached" on proto
Browse files Browse the repository at this point in the history
with --optimize=0, all is ok.  With any other setting, the proto is taken out
and two tests fail.
  • Loading branch information
lizmat committed May 1, 2014
1 parent 9c839e2 commit c9dced7
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion S02-names/is_cached.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 30;
plan 38;

#?pugs skip "is cached NYI"
#?niecza skip "is cached NYI"
Expand Down Expand Up @@ -67,4 +67,26 @@ plan 30;
is @seen, [<foo bar foo bar baz>], 'did we run (4)';
} #8

#?pugs skip "is cached NYI"
#?niecza skip "is cached NYI"
{
my @int;
my @str;
proto foo (|) is cached { * }
multi foo (Int $number) { @int.push: $number; $number }
multi foo (Str $string) { @str.push: $string; $string }

is foo(42), 42, 'did we get the value back (1)';
is_deeply @int, [42], 'was the code done (1)';
is foo(42), 42, 'did we get the value back (2)';
#?rakudo todo 'optimizer kills the proto even though "is cached"'
is_deeply @int, [42], 'was the code done (2)';

is foo("Camelia"), "Camelia", 'did we get the value back (3)';
is_deeply @str, [<Camelia>], 'was the code done (3)';
is foo("Camelia"), "Camelia", 'did we get the value back (4)';
#?rakudo todo 'optimizer kills the proto even though "is cached"'
is_deeply @str, [<Camelia>], 'was the code done (4)';
} #4

# vim: ft=perl6

0 comments on commit c9dced7

Please sign in to comment.