Skip to content

Commit

Permalink
add test for :context<void> when calling p5 functions
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Oct 16, 2011
1 parent ddc1d53 commit cab8084
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions S01-perl-5-integration/context.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use v6;
use Test;
my &p5_void := eval(
'sub {
if (defined(wantarray)) {
$::got_void = 0;
} else {
$::got_void = 1;
}
}',:lang<perl5>);
p5_void(:context<void>);
is(eval(:lang<perl5>,'$::got_void'),1,":contex<void> sets voidcontext");
p5_void(:context<scalar>);
is(eval(:lang<perl5>,'$::got_void'),0,":contex<scalar> dosn't set voidcontext");
p5_void(:context<list>);
is(eval(:lang<perl5>,'$::got_void'),0,":contex<list> dosn't sets voidcontext");
done;
# vim: ft=perl6

0 comments on commit cab8084

Please sign in to comment.