Permalink
Browse files

[t/spec] .constraints tests

git-svn-id: http://svn.pugscode.org/pugs@28705 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 1e2c1f0 commit 19d86b01a0c919034269ba9940f7eddecb3be6ee moritz committed Oct 10, 2009
Showing with 11 additions and 1 deletion.
  1. +11 −1 S06-signature/introspection.t
@@ -65,9 +65,19 @@ plan *;
ok ?( all(@l) ~~ Code ), '.default returns closure';
is @l[0].(), 3, 'first closure works';
is @l[1].().(), 5, 'closure as default value captured outer default value';
-
}
+{
+ sub f(Int $x where { $_ % 2 == 0 }) { };
+ my $p = &f.signature.params[0];
+ #?rakudo todo '.constraints'
+ ok 4 ~~ $p.constraints, '.constraints (+)';
+ ok 5 !~~ $p.constraints, '.constraints (-)';
+ #?rakudo todo '.constraints'
+ ok 5 ~~ (-> $x { }).signature.params[0].constraints,
+ '.constraints on unconstraint param should still smartmatch truely';
+ sub g(Any $x where Int) { };
+}
done_testing;

0 comments on commit 19d86b0

Please sign in to comment.