Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[t/spec] Basic tests for typed named parameters including optional ch…

…eck - seems we didn't have any such tests.

git-svn-id: http://svn.pugscode.org/pugs@25296 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit baf377f1847ede045d44ca173205c1b47c8d8d40 1 parent 4b21842
jnthn authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 S06-signature/named-parameters.t
View
9 S06-signature/named-parameters.t
@@ -1,7 +1,7 @@
use v6;
use Test;
-plan 69;
+plan 72;
# L<S06/Required parameters/"Passing a named argument that cannot be bound to
# a normal subroutine is also a fatal error.">
@@ -202,4 +202,11 @@ ok(%fellowship<dwarf> ~~ undef, "dwarf arg was not given");
is($ref[0], 1, "ref is the same as aref");
}
+{
+ sub typed_named(Int :$x) { 1 }
+ is(typed_named(:x(42)), 1, 'typed named parameters work...');
+ is(typed_named(), 1, '...when value not supplied also...');
+ dies_ok({ typed_named("BBQ") }, 'and the type check is enforced');
+}
+
# vim: ft=perl6
Please sign in to comment.
Something went wrong with that request. Please try again.