Skip to content

Commit

Permalink
Loosen no-multi tests for Mu.[]/Mu.{}
Browse files Browse the repository at this point in the history
The tests test there's no candidate to handle the Mu, but
testing for X::Multi::NoMatch is too strict a restriction.

Allow X::TypeCheck::Binding::Parameter to be thrown as well in those
cases.
  • Loading branch information
zoffixznet committed Apr 21, 2018
1 parent d35c12e commit 16594c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions S02-types/array.t
@@ -1,6 +1,7 @@
use v6;

use lib $?FILE.IO.parent(2).add: 'packages';
use Test;
use Test::Util;

plan 104;

Expand Down Expand Up @@ -280,8 +281,8 @@ my @array2 = ("test", 1, Mu);
is 'abc'[0], 'abc', '.[0] is identity operation for scalars (Str)';
nok 'abc'[1].defined, '.[1] on a scalar is not defined';
isa-ok 1[1], Failure, 'indexing a scalar with other than 0 returns a Failure';
throws-like { Mu.[0] },
X::Multi::NoMatch,
throws-like-any { Mu.[0] },
[X::Multi::NoMatch, X::TypeCheck::Binding::Parameter],
'but Mu has no .[]';
}

Expand Down
7 changes: 4 additions & 3 deletions S02-types/hash.t
@@ -1,6 +1,7 @@
use v6;

use lib $?FILE.IO.parent(2).add: 'packages';
use Test;
use Test::Util;

plan 95;

Expand Down Expand Up @@ -242,8 +243,8 @@ lives-ok { Hash.new("a" => "b") }, 'Hash.new($pair) lives';
my $x;
lives-ok { $x{'a'} }, 'can index a variable that defaults to Any';
nok $x{'a'}.defined, '... and the result is not defined';
throws-like { Mu.{'a'} },
X::Multi::NoMatch,
throws-like-any { Mu.{'a'} },
[X::Multi::NoMatch, X::TypeCheck::Binding::Parameter],
'no .{ } in Mu';
}

Expand Down

0 comments on commit 16594c6

Please sign in to comment.