Permalink
Browse files

Update signature introspection test for current spec, remove all but …

…one Rakudo fudge.
  • Loading branch information...
1 parent 22d53ea commit 31dd22f89252dd8a6274700f3343b5fe4b568be4 @jnthn jnthn committed Jan 12, 2012
Showing with 8 additions and 15 deletions.
  1. +8 −15 S06-signature/introspection.t
@@ -12,8 +12,7 @@ sub j(*@i) {
sub a($x, Int $y?, :$z) { }; #OK not used
ok &a.signature.params ~~ Positional, '.params does Positional';
my @l = &a.signature.params;
- #?rakudo todo 'types or autothreading'
- ok ?(all(@l) ~~ Parameter), 'And all items are Parameters';
+ ok ?(all(@l >>~~>> Parameter)), 'And all items are Parameters';
is +@l, 3, 'we have three of them';
is ~(@l>>.name), '$x $y $z', 'can get the names with sigils';
ok @l[0].type === Any, 'Could get first type';
@@ -22,22 +21,19 @@ sub j(*@i) {
is j(@l>>.readonly), '1 1 1', 'they are all read-only';
is j(@l>>.rw), '0 0 0', '... none rw';
is j(@l>>.copy), '0 0 0', '... none copy';
- is j(@l>>.ref), '0 0 0', '... none ref';
+ is j(@l>>.parcel), '0 0 0', '... none ref';
is j(@l>>.slurpy), '0 0 0', '... none slurpy';
is j(@l>>.optional), '0 1 1', '... some optional';
is j(@l>>.invocant), '0 0 0', '... none invocant';
is j(@l>>.named), '0 0 1', '... one named';
}
-#?rakudo skip 'is ref'
{
- sub b(:x($a)! is rw, :$y is ref, :$z is copy) { }; #OK not used
+ sub b(:x($a)! is rw, :$y is parcel, :$z is copy) { }; #OK not used
my @l = &b.signature.params;
- #?rakudo todo 'is ref'
is j(@l>>.readonly), '0 0 0', '(second sig) none are all read-only';
is j(@l>>.rw), '1 0 0', '... one rw';
- #?rakudo todo 'is ref'
- is j(@l>>.ref), '0 1 0', '... one ref';
+ is j(@l>>.parcel), '0 1 0', '... one parcel';
is j(@l>>.copy), '0 0 1', '... one copy';
is j(@l>>.slurpy), '0 0 0', '... none slurpy';
is j(@l>>.optional), '0 1 1', '... some optional';
@@ -66,23 +62,21 @@ sub j(*@i) {
{
sub e($x = 3; $y = { 2 + $x }) { }; #OK not used
my @l = &e.signature.params>>.default;
- #?rakudo todo 'types or autothreading'
- ok ?( all(@l) ~~ Code ), '.default returns closure';
+ ok ?( all(@l >>~~>> Code) ), '.default returns closure';
is @l[0].(), 3, 'first closure works';
+ # XXX The following test is very, very dubious...
#?rakudo skip 'default closure when no call made fails lexical lookup with NPMCA'
is @l[1].().(), 5, 'closure as default value captured outer default value';
}
{
sub f(Int $x where { $_ % 2 == 0 }) { }; #OK not used
my $p = &f.signature.params[0];
- #?rakudo todo 'constraints'
ok 4 ~~ $p.constraints, '.constraints (+)';
ok 5 !~~ $p.constraints, '.constraints (-)';
ok 5 ~~ (-> $x { }).signature.params[0].constraints,
'.constraints on unconstraint param should still smartmatch truely';
sub g(Any $x where Int) { }; #OK not used
- #?rakudo todo 'constraints'
ok 3 ~~ &g.signature.params[0].constraints,
'smartmach against non-closure constraint (+)';
ok !(3.5 ~~ &g.signature.params[0].constraints),
@@ -115,9 +109,8 @@ sub j(*@i) {
ok :(|$x).params[0].capture, 'prefix | makes .capture true';
ok :(|$x).perl ~~ / '|' /, 'prefix | appears in .perl output';
- #?rakudo 2 skip 'parcel binding'
- ok :(\|$x).params[0].parcel, 'prefix \| makes .parcel true';
- ok :(\|$x).perl ~~ / '\|' /, 'prefix \| appears in .perl output';
+ ok :(\$x).params[0].parcel, 'prefix \\ makes .parcel true';
+ ok :(\$x).perl ~~ / '\\' /, 'prefix \\ appears in .perl output';
}
# RT #69492

0 comments on commit 31dd22f

Please sign in to comment.