Skip to content

Commit

Permalink
Merge pull request #777 from usev6/errors_wrong_arity
Browse files Browse the repository at this point in the history
Tweak tests for error message for wrong arity
  • Loading branch information
lizmat committed Jan 3, 2022
2 parents f151ad5 + 42251a2 commit f11f198
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
8 changes: 4 additions & 4 deletions S02-types/built-in.t
Expand Up @@ -8,15 +8,15 @@ plan 1;
# L<S02/Built-In Data Types>

# https://github.com/Raku/old-issue-tracker/issues/3413
# TODO: better test (e.g. typed exception instead of testing for backend specific error messages
# TODO: typed exception instead of testing for specific error message
{
throws-like {
my $foo = ObjAt.new(:val("test"));
$foo ~~ /"foo"/;
},
Exception,
message => / 'Too few positionals passed; expected 2 arguments but got 1' /,
'no segfault in ObjAt initalization when passing bogus named parameters';
Exception,
message => / 'Too few positionals passed' .+ 'expected 2 arguments but got 1' /,
'no segfault in ObjAt initialization when passing bogus named arguments';
}

# vim: expandtab shiftwidth=4
10 changes: 2 additions & 8 deletions S03-sequence/arity-2-or-more.t
Expand Up @@ -44,16 +44,10 @@ is (1, 1, 2, 3, { $^a + $^b } ... 9).[^7].join(', '), '1, 1, 2, 3, 5, 8, 13', 'a
is (1, 2, sub {[*] @_[*-1], @_ + 1} ... 720).join(' '), '1 2 6 24 120 720', 'slurpy factorial generator';

# https://github.com/Raku/old-issue-tracker/issues/3118
# TODO: better test (e.g. typed exception instead of testing for backend specific error messages
# TODO: typed exception instead of testing for specific error message
{
throws-like { ( ^1, *+* ... * )[^20] }, Exception,
message => {
m/
'Too few positionals passed; expected 2 arguments but got 1'
|
'Not enough positional parameters passed; got 1 but expected 2'
/
},
message => / 'Too few positionals passed' .+ 'expected 2 arguments but got 1' /,
'no internals leaking out with series operator used wrongly (arity 2)';
}

Expand Down

0 comments on commit f11f198

Please sign in to comment.