Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix tests relating to "is context", which apparently now is "is dynamic"
  • Loading branch information
lizmat committed Jul 26, 2013
1 parent f4c5ed8 commit 2d48e36
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions S03-binding/scalars.t
Expand Up @@ -48,8 +48,8 @@ eval_dies_ok '0 := 1', 'cannot bind to a literal';
}

sub foo {
my $a is context = "foo";
my $b is context := $a; #OK not used
my $a is dynamic = "foo";
my $b is dynamic := $a; #OK not used
return bar(); # && bar2();
}

Expand Down
18 changes: 8 additions & 10 deletions S03-operators/context-forcers.t
Expand Up @@ -139,13 +139,12 @@ sub eval_elsewhere($code){ eval($code) }
ok(?$d, 'it is forced into boolean context');
}

#?rakudo skip 'is context'
#?niecza skip 'Trait context not available on variables'
#?niecza skip 'Trait dynamic not available on variables'
{
my $arrayref is context = list(1,2,3);
my $boo is context = 37;
ok eval_elsewhere('?(@$+arrayref)'), '?(@$arrayref) syntax works';
ok eval_elsewhere('?(@($+arrayref))'), '?(@($arrayref)) syntax works';
my $arrayref is dynamic = list(1,2,3);
my $boo is dynamic = 37;
ok eval_elsewhere('?(@$*arrayref)'), '?(@$arrayref) syntax works';
ok eval_elsewhere('?(@($*arrayref))'), '?(@($arrayref)) syntax works';
}

# L<S03/Symbolic unary precedence/"prefix:<!>">
Expand All @@ -167,13 +166,12 @@ sub eval_elsewhere($code){ eval($code) }
ok(!(!$d), 'it is forced into boolean context');

}
#?rakudo skip 'is context'
#?niecza skip 'Trait context not available on variables'
{
my $arrayref is context = list(1,2,3);
my $arrayref is dynamic = list(1,2,3);

ok eval_elsewhere('!(!(@$+arrayref))'), '!(@$arrayref) syntax works';
ok eval_elsewhere('!(!(@($+arrayref)))'), '!(@($arrayref)) syntax works';
ok eval_elsewhere('!(!(@$*arrayref))'), '!(@$arrayref) syntax works';
ok eval_elsewhere('!(!(@($*arrayref)))'), '!(@($arrayref)) syntax works';
}

# int context
Expand Down
5 changes: 3 additions & 2 deletions S04-statements/lift.t
Expand Up @@ -75,15 +75,16 @@ plan 15;
ok !('1' ceq 2), 'basic operation with coercion (-)';
}

#?rakudo skip "lift NYI"
{
# I hope I understood this part of specs correctly:
# L<S04/The C<lift> statement prefix/"Everything else within a lift">
# etc.
# IMHO that means that it's OK to use undeclared variables in a lift:
sub f { lift $a + $b };
{
my $a is context = 3;
my $b is context = 4;
my $a is dynamic = 3;
my $b is dynamic = 4;
is f(), 7, 'Can pick up context variables from the caller';
}
eval_dies_ok 'f()',
Expand Down

0 comments on commit 2d48e36

Please sign in to comment.