This is an automatically generated mail to inform you that tests are now
available in t/spec/S06-signature/errors.t
commit eb0fb473ff6dfd31d3a250ee6878793de81360c4
Author: moritz <mor...@c213334d-75ef-0310-aa23-eaa082d1ae64>
Date: Fri Apr 30 15:46:40 2010 +0000
[t/spec] test for RT #71478, sensible error message for passing two
arguments to one hash parameter
git-svn-id: http://svn.pugscode.org/p...@30518
c213334d-75ef-0310-aa23-eaa082d1ae64
diff --git a/t/spec/S06-signature/errors.t b/t/spec/S06-signature/errors.t
index 1ee9f31..439be84 100644
--- a/t/spec/S06-signature/errors.t
+++ b/t/spec/S06-signature/errors.t
@@ -1,8 +1,8 @@
-use v6;
+ use v6;
use Test;
-plan 5;
+ plan 9;
=begin pod
@@ -15,7 +15,7 @@ sub foo (*$x) { 1 }
dies_ok { foo(reverse(1,2)) }, 'slurpy args are now bounded (1)';
sub bar (*...@x) { 1 }
-lives_ok { bar(reverse(1,2)) }, 'slurpy args are now bounded (2)';
+lives_ok { bar(reverse(1,2)) }, 'slurpy args are not bounded (2)';
eval_dies_ok 'sub quuux ($?VERSION) { ... }',
'parser rejects magicals as args (1)';
@@ -30,4 +30,15 @@ eval_dies_ok('sub quuuux ($!) { ... }',
'argument passed to sub with empty signature';
}
+# RT #71478
+{
+ my $success = eval 'sub foo(%h) { }; foo(1, 2); 1';
+ my $error = "$!";
+ nok $success,
+ "Passing two arguments to a function expecting one hash is an error";
+ ok $error ~~ / '%h' /, '... error message mentions parameter';
+ ok $error ~~ /:i 'type' /, '... error message mentions "type"';
+ ok $error ~~ / Associative /, '... error message mentions "Associative"';
+}
+
# vim: ft=perl6