Permalink
Browse files

[t/spec] first real signature introspection tests

git-svn-id: http://svn.pugscode.org/pugs@28677 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 00cdcdf commit 94a975649863a30244964d683bbaf17bd74eb17e moritz committed Oct 9, 2009
Showing with 30 additions and 0 deletions.
  1. +30 −0 S06-signature/introspection.t
View
30 S06-signature/introspection.t
@@ -0,0 +1,30 @@
+use v6;
+use Test;
+plan *;
+
+# L<S06/Signature Introspection>
+
+{
+ my sub a($x, Int $y?, :$z) { };
+ isa_ok &a.signature.params, List, '.params is a List';
+ my @l = &a.signature.params;
+ ok ?(all(@l) ~~ Parameter), 'And all items are Paramters';
+ 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';
+ ok @l[1].type === Int, 'Could get second type';
+
+ is ~(@l>>.readonly), '1 1 1', 'they are all read-only';
+ is ~(@l>>.rw), '0 0 0', '... none rw';
+ is ~(@l>>.copy), '0 0 0', '... none copy';
+ is ~(@l>>.ref), '0 0 0', '... none ref';
+ is ~(@l>>.slurpy), '0 0 0', '... none slurpy';
+ is ~(@l>>.optional), '0 1 1', '... some optional';
+ is ~(@l>>.invocant), '0 0 0', '... none invocant';
+
+}
+
+
+done_testing;
+
+# vim: ft=perl6

0 comments on commit 94a9756

Please sign in to comment.