Skip to content

Commit

Permalink
[v6.d REVIEW] Add multi-no-match.t APPENDIX
Browse files Browse the repository at this point in the history
The tests in this file ensure certain constructs die with a decent error
instead of hanging or crashing by spilling compiler guts.

Since there's yet no existing behaviour for some of such combinations,
X::Multi::NoMatch is thrown. This APPENDIX test file is for such tests.
  • Loading branch information
zoffixznet committed Jul 19, 2018
1 parent ab0a933 commit 4bce18d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
17 changes: 17 additions & 0 deletions APPENDICES/A02-some-day-maybe/multi-no-match.t
@@ -0,0 +1,17 @@
use v6;
use Test;

# The tests in this file ensure certain constructs die with a decent error
# instead of hanging or crashing by spilling compiler guts.
#
# Since there's yet no existing behaviour for some of such combinations,
# X::Multi::NoMatch is thrown. This APPENDIX test file is for such tests.

plan 2;

{ # RT #129773
throws-like { [].splice: 0, [] }, X::Multi::NoMatch,
'.splice(offset, array) throws';
throws-like { [].splice: 0e0, 0 }, X::Multi::NoMatch,
'.splice(wrong type offset...) throws';
}
6 changes: 1 addition & 5 deletions S32-array/splice.t
Expand Up @@ -45,7 +45,7 @@ my @testing =
# $@Num, Array[Num], # need way to handle named params in capture
;

plan (@testing/2 * 54) + 16;
plan (@testing/2 * 54) + 14;

for @testing -> @a, $T {
my $toNum = @a.of ~~ Num;
Expand Down Expand Up @@ -257,10 +257,6 @@ for @testing -> @a, $T {

# RT #129773
{
throws-like { [].splice: 0, [] }, X::Multi::NoMatch,
'.splice(offset, array) throws';
throws-like { [].splice: 0e0, 0 }, X::Multi::NoMatch,
'.splice(wrong type offset...) throws';
lives-ok { [].splice: *, {42;} }, 'splice(Whatever, Callable) lives';
lives-ok { [].splice: *, {42;}, [42] }, 'splice(Whatever, Callable, @a) lives';
}
Expand Down

0 comments on commit 4bce18d

Please sign in to comment.