Skip to content

Commit

Permalink
Add tests for RT #118581 and RT #118067
Browse files Browse the repository at this point in the history
  • Loading branch information
usev6 committed Oct 16, 2014
1 parent de19d97 commit d55c943
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
14 changes: 11 additions & 3 deletions S03-smartmatch/capture-signature.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 5;
plan 6;

sub t1(%h) {
given %h {
Expand All @@ -26,8 +26,16 @@ is t2([1]), "godis", "signature smart-match against array works (1)";
is t2([1,2]), "om nom nom", "signature smart-match against array works (2)";

# RT #77164
sub f($ = rand) { };
ok \() ~~ &f.signature, 'can smart-match against a signature with a default value';
{
sub f($ = rand) { };
ok \() ~~ &f.signature, 'can smart-match against a signature with a default value';
}

# RT #118581
{
lives_ok { \(1) ~~ :(int $x as Str) },
'can match integer capture against signature with native integer coercing to Str';
}

done;

Expand Down
11 changes: 9 additions & 2 deletions S32-exceptions/misc.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 271;
plan 272;

#?DOES 1
throws_like { Buf.new().Str }, X::Buf::AsStr, method => 'Str';;
Expand Down Expand Up @@ -550,12 +550,19 @@ throws_like '&[doesntexist]', X::Comp, # XXX probably needs exception type fix
message => 'Term definition requires an initializer';
}

#RT #88748
# RT #88748
{
throws_like { EVAL q[given 42 { when SomeUndeclaredType { 1 }; default { 0 } }] },
X::Comp::Group,
'adequate error message when undeclared type is used in "when" clause',
message => { m/'Function SomeUndeclaredType needs parens to avoid gobbling block'/ };
}

# RT #118067
{
my class A is Any { proto method new($) {*} };
throws_like { A.new(now) }, X::Multi::NoMatch,
'no NullPMC access error but exception X::Multi::NoMatch';
}

# vim: ft=perl6

0 comments on commit d55c943

Please sign in to comment.