Skip to content

Commit

Permalink
Test for X::AdHoc (with throws-like) instead of using eval-dies-ok
Browse files Browse the repository at this point in the history
Even when there is no typed exception (yet), it's better
to use throws-like instead of eval-dies-ok. With eval-dies-ok
there is a greater chance that the code dies for the wrong
reason. Testing for X::AdHoc makes it easier to adjust tests
after upgrading to typed exceptions.

Optionally, all X::AdHoc could be changed to 'Exception'
shortly before releasing 6.Christmas (to become more stable
wrt throws-like).

See http://irclog.perlgeek.de/perl6/2015-09-22#i_11258578
  • Loading branch information
usev6 committed Sep 29, 2015
1 parent 93b33fd commit a7b77c2
Show file tree
Hide file tree
Showing 34 changed files with 81 additions and 80 deletions.
2 changes: 1 addition & 1 deletion S02-types/type.t
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ my Str $bar;
#?niecza skip 'native types (noauto)'
{
eval-lives-ok('my int $alpha = 1', 'Has native type int');
eval-dies-ok('my int $alpha = Nil', 'native int type cannot be undefined');
throws-like 'my int $alpha = Nil', X::AdHoc, 'native int type cannot be undefined';
lives-ok({my Int $beta = Nil}, 'object Int type can be undefined');
eval-lives-ok('my num $alpha = 1e0', 'Has native type num');
#?rakudo.jvm todo "nigh"
Expand Down
2 changes: 1 addition & 1 deletion S03-operators/autoincrement.t
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ is(%z{0}, $base, '%z{0}');
}

# RT #63644
eval-dies-ok 'my $a; $a++ ++;', 'parse error for "$a++ ++"';
throws-like 'my $a; $a++ ++;', X::AdHoc, 'parse error for "$a++ ++"';

# RT #99731
{
Expand Down
4 changes: 2 additions & 2 deletions S03-operators/subscript-vs-lt.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ plan 4;

eval-lives-ok "1 <2", "infix less-than (<) requires whitespace before.";
eval-lives-ok "1 < 2" , "infix less-than (<) requires whitespace before.";
eval-dies-ok("1< 2", "infix less-than (<) requires whitespace before, so this is a parse error.");
eval-dies-ok("1<2", "infix less-than (<) requires whitespace before, so this is a parse error.");
throws-like "1< 2", X::AdHoc, "infix less-than (<) requires whitespace before, so this is a parse error.";
throws-like "1<2", X::AdHoc, "infix less-than (<) requires whitespace before, so this is a parse error.";

# vim: ft=perl6
2 changes: 1 addition & 1 deletion S03-sequence/basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ is (5,4,3, { $_ - 1 || last } ... *)[^10].join(', '), '5, 4, 3, 2, 1', "sequence
}

# RT #75828
eval-dies-ok '1, 2, 3, ... 5', 'comma before sequence operator is caught';
throws-like '1, 2, 3, ... 5', X::AdHoc, 'comma before sequence operator is caught';

# RT #73268
is ~(1...^*).[^10], '1 2 3 4 5 6 7 8 9 10', 'RT #73268';
Expand Down
2 changes: 1 addition & 1 deletion S03-sequence/misc.t
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ is ('a', 'b', 'c', { $^x ~ 'x', $^y ~ 'y' ~ $^z ~ 'z' } ... *)[^9].join(' '), 'a

# L<S03/List infix precedence/it will be taken as a yada>

eval-dies-ok '(1, 2, ... 3)[2]', 'yada operator not confused for sequence operator'; #OK apparent sequence operator
throws-like '(1, 2, ... 3)[2]', X::AdHoc, 'yada operator not confused for sequence operator'; #OK apparent sequence operator

# L<S03/List infix precedence/and another function to continue the list>
# chained sequence
Expand Down
2 changes: 1 addition & 1 deletion S04-exception-handlers/catch.t
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ eval-lives-ok 'my %a; %a{ CATCH { } }', 'can define CATCH bock in .{}';
# RT #73988
throws-like 'do { CATCH {}; CATCH { } }', X::Phaser::Multiple, 'only one CATCH per block allowed';
# RT #115184
eval-dies-ok 'try { CATCH { ~$! }; die }', "doesn't segfault";
throws-like 'try { CATCH { ~$! }; die }', X::AdHoc, "doesn't segfault";

# RT #121213
{
Expand Down
2 changes: 1 addition & 1 deletion S04-statements/terminator.t
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ throws-like "42 if 23\nis 50; 1", X::Syntax::Confused,
"if postfix modifier and is() is parsed correctly";

# not sure this belong here, suggestions for better places are welcome
eval-dies-ok '(1) { $foo = 2 }', 'parens do not eat spaces after them';
throws-like '(1) { $foo = 2 }', X::AdHoc, 'parens do not eat spaces after them';

# RT #79964
eval-lives-ok q:b"my &f;\nsub g() { }\n&f;", 'implicit terminator before & sigil';
Expand Down
2 changes: 1 addition & 1 deletion S05-grammar/parse_and_parsefile.t
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ nok(A::B.parse("zzz42zzz"), ".parse works with namespaced grammars, no match");
is(~A::B.parse("42"), "42", ".parse works with namespaced grammars, match");

# TODO: Check for a good error message, not just the absence of a bad one.
eval-dies-ok '::No::Such::Grammar.parse()', '.parse on missing grammar dies';
throws-like '::No::Such::Grammar.parse()', X::AdHoc, '.parse on missing grammar dies';

# RT #71062
{
Expand Down
4 changes: 2 additions & 2 deletions S05-grammar/polymorphism.t
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ is(~$/, "DeF", '.Yet::Another.def $/');

# Non-existent rules...

eval-dies-ok q{ 'abc' ~~ m/ (<Another.sea>) / }, '<Another.sea>';
throws-like q{ 'abc' ~~ m/ (<Another.sea>) / }, X::AdHoc, '<Another.sea>';

# RT #63466
{
eval-dies-ok q{ 'x' ~~ / <No::Such::Rule> / },
throws-like q{ 'x' ~~ / <No::Such::Rule> / }, X::AdHoc,
'match against No::Such::Rule dies';
}

Expand Down
4 changes: 2 additions & 2 deletions S05-interpolation/regex-in-variable.t
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ok(!('aaaaab' ~~ m/"$foo"/), 'Rulish scalar match 7');

# RT #100232
#?rakudo todo 'escaping characters before EVAL is the wrong way to fix this RT #100232'
eval-dies-ok Q[my $x = '1} if say "pwnd"; #'; 'a' ~~ /<$x>/], "particular garbage-in recognized as being garbage (see RT)";
throws-like Q[my $x = '1} if say "pwnd"; #'; 'a' ~~ /<$x>/], X::AdHoc, "particular garbage-in recognized as being garbage (see RT)";

# because it broke these:
{
Expand All @@ -57,7 +57,7 @@ eval-dies-ok Q[my $x = '1} if say "pwnd"; #'; 'a' ~~ /<$x>/], "particular garbag
}

#?rakudo todo 'and no need to go all Bobby Tables either RT #124633'
eval-dies-ok Q['a' ~~ /<{'$(say "trivially pwned")'}>/], "should handle this too";
throws-like Q['a' ~~ /<{'$(say "trivially pwned")'}>/], X::AdHoc, "should handle this too";

# Arrays

Expand Down
32 changes: 16 additions & 16 deletions S05-mass/rx.t
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ ok 'bbccdd' !~~ /<-[b..d]>/, 'negated character range';

#### <-[d..b]> dies
#?niecza todo ""
eval-dies-ok '/<-[d..b]>/', 'illegal character range';
throws-like '/<-[d..b]>/', X::AdHoc, 'illegal character range';

ok '-' ~~ /<[-]>/, 'unescaped hyphen is fine on its own';

Expand Down Expand Up @@ -521,7 +521,7 @@ ok 'az' ~~ /<+alpha>+/, 'metasyntax with leading + (<+...>)';


#### a[b} \t\n\r !"#$%&\'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /rule error/ mismatched close
eval-dies-ok '/a[b}/', 'mismatched close';
throws-like '/a[b}/', X::AdHoc, 'mismatched close';


#### c <before .d> abacad /mob: <c @ 3>/ one character and lookahead <before>
Expand Down Expand Up @@ -836,28 +836,28 @@ ok 'abc' ~~ / | d | b/, 'leading alternation ignored';
throws-like '/ b | | d/', X::Syntax::Regex::NullRegex, 'null pattern invalid';

#### \pabc pabc /reserved/ retired metachars (\p)
eval-dies-ok '/\pabc/', 'retired metachars (\p)';
throws-like '/\pabc/', X::AdHoc, 'retired metachars (\p)';

#### \p{InConsonant} a /reserved/ retired metachars (\p)
eval-dies-ok '/\p{InConsonant}/', 'retired metachars (\p)';
throws-like '/\p{InConsonant}/', X::AdHoc, 'retired metachars (\p)';

#### \Pabc Pabc /reserved/ retired metachars (\P)
eval-dies-ok '/\Pabc/', 'retired metachars (\P)';
throws-like '/\Pabc/', X::AdHoc, 'retired metachars (\P)';

#### \P{InConsonant} a /reserved/ retired metachars (\P)
eval-dies-ok '/\P{InConsonant}/', 'retired metachars (\P)';
throws-like '/\P{InConsonant}/', X::AdHoc, 'retired metachars (\P)';

#### \Labc\E LabcE /reserved/ retired metachars (\L...\E)
eval-dies-ok '/\Labc\E/', 'retired metachars (\L...\E)';
throws-like '/\Labc\E/', X::AdHoc, 'retired metachars (\L...\E)';

#### \LABC\E abc /reserved/ retired metachars (\L...\E)
eval-dies-ok '/\LABC\E/', 'retired metachars (\L...\E)';
throws-like '/\LABC\E/', X::AdHoc, 'retired metachars (\L...\E)';

#### \Uabc\E UabcE /reserved/ retired metachars (\U...\E)
eval-dies-ok '/\Uabc\E/', 'retired metachars (\U...\E)';
throws-like '/\Uabc\E/', X::AdHoc, 'retired metachars (\U...\E)';

#### \Uabc\E ABC /reserved/ retired metachars (\U...\E)
eval-dies-ok '/\Uabc\E/', 'retired metachars (\U...\E)';
throws-like '/\Uabc\E/', X::AdHoc, 'retired metachars (\U...\E)';

#### \Qabc\E QabcE /reserved/ retired metachars (\Q...\E)
throws-like '/\Qabc\E/', X::Obsolete, 'retired metachars (\Q...\E)';
Expand All @@ -866,10 +866,10 @@ throws-like '/\Qabc\E/', X::Obsolete, 'retired metachars (\Q...\E)';
throws-like '/\Qabc d?\E/', X::Obsolete, 'retired metachars (\Q...\E)';

#### \Gabc Gabc /reserved/ retired metachars (\G)
eval-dies-ok '/\Gabc/', 'retired metachars (\G)';
throws-like '/\Gabc/', X::AdHoc, 'retired metachars (\G)';

#### \1abc 1abc /reserved/ retired metachars (\1)
eval-dies-ok '/\1abc/', 'retired metachars (\1)';
throws-like '/\1abc/', X::AdHoc, 'retired metachars (\1)';

#### ^ \s+ $ \x0009\x0020\x00a0\x000a\x000b\x000c\x000d\x0085 y 0-255 whitespace (\s)
ok "\x0009\x0020\x00a0\x000a\x000b\x000c\x000d\x0085" ~~ /^ \s+ $/, '0-255 whitespace (\s)';
Expand Down Expand Up @@ -2297,13 +2297,13 @@ ok 'aJc' !~~ /^<+alpha-[Jj]>+$/, 'character class with no j fail';
eval-dies-ok '/{{/', 'unterminated closure';

#### \1 abcdef /reserved/ back references
eval-dies-ok '/\1/', 'back references';
throws-like '/\1/', X::AdHoc, 'back references';

#### \x[ abcdef /Missing close bracket/ unterminated \x[..]
eval-dies-ok '/\x[/', 'unterminated \x[..]';
throws-like '/\x[/', X::AdHoc, 'unterminated \x[..]';

#### \X[ abcdef /Missing close bracket/ unterminated \X[..]
eval-dies-ok '/\X[/', 'unterminated \X[..]';
throws-like '/\X[/', X::AdHoc, 'unterminated \X[..]';


#### * abc abcdef /Quantifier follows nothing/ bare * at start
Expand Down Expand Up @@ -2374,6 +2374,6 @@ throws-like '"b" ~~ /b| /', X::Syntax::Regex::NullRegex, 'null pattern after alt

# RT #71702
#?niecza todo 'allows them'
eval-dies-ok '"foo" ~~ /<[d..b]>? foo/', 'no reversed char ranges';
throws-like '"foo" ~~ /<[d..b]>? foo/', X::AdHoc, 'no reversed char ranges';

# vim: ft=perl6 sw=4 expandtab
8 changes: 4 additions & 4 deletions S05-metasyntax/angle-brackets.t
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ character classes), and those are referenced at the correct spot.

# No other characters are allowed after the initial identifier.
{
eval-dies-ok('"foo" ~~ /<test*>/', 'no other characters are allowed (*)');
eval-dies-ok('"foo" ~~ /<test|>/', 'no other characters are allowed (|)');
eval-dies-ok('"foo" ~~ /<test&>/', 'no other characters are allowed (&)');
throws-like '"foo" ~~ /<test*>/', X::AdHoc, 'no other characters are allowed (*)';
throws-like '"foo" ~~ /<test|>/', X::AdHoc, 'no other characters are allowed (|)';
throws-like '"foo" ~~ /<test&>/', X::AdHoc, 'no other characters are allowed (&)';
eval-dies-ok('"foo" ~~ /<test:>/', 'no other characters are allowed (:)');
}

Expand Down Expand Up @@ -261,7 +261,7 @@ character classes), and those are referenced at the correct spot.
# XXX: Should be warns_ok, but we don't have that yet
lives-ok({'foo' ~~ /<???>/}, '<???> lives in regex match');
#?rakudo todo '!!! in regexes'
eval-dies-ok('"foo" ~~ /<!!!>/', '<!!!> dies in regex match');
throws-like '"foo" ~~ /<!!!>/', X::AdHoc, '<!!!> dies in regex match';
}
# A leading * indicates that the following pattern allows a partial match.
Expand Down
4 changes: 2 additions & 2 deletions S05-metasyntax/charset.t
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ ok( "foo" ~~ /<[f] #`[comment] + [o]>/, 'comment embedded in charset works' );
ok "\x[FFEF]" ~~ /<[\x0..\xFFEF]>/, 'large \\x char spec';

#?niecza todo
eval-dies-ok( "'RT 71702' ~~ /<[d..b]>? RT/",
'reverse range in charset is lethal (RT 71702)' );
throws-like "'RT 71702' ~~ /<[d..b]>? RT/", X::AdHoc,
'reverse range in charset is lethal (RT 71702)';

# RT #64220
ok 'b' ~~ /<[. .. b]>/, 'weird char class matches at least its end point';
Expand Down
2 changes: 1 addition & 1 deletion S05-metasyntax/regex.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ throws-like 'rx(o)', X::Undeclared::Symbols,
'rx () requires whitespace if the delims are parens';
isa-ok(regex {oo}, Regex);

eval-dies-ok('rx :foo:', 'colons are not allowed as rx delimiters');
throws-like 'rx :foo:', X::AdHoc, 'colons are not allowed as rx delimiters';

lives-ok { my Regex $x = rx/foo/ }, 'Can store regexes in typed variables';

Expand Down
2 changes: 1 addition & 1 deletion S05-metasyntax/unknown.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ throws-like '"aa!" ~~ /!/', X::Syntax::Regex::UnrecognizedMetachar,
lives-ok({"aa!" ~~ /\!/}, 'escaped "!" is valid');
lives-ok({"aa!" ~~ /'!'/}, 'quoted "!" is valid');

eval-dies-ok('"aa!" ~~ /\a/', 'escaped "a" is not valid metasyntax');
throws-like '"aa!" ~~ /\a/', X::AdHoc, 'escaped "a" is not valid metasyntax';
lives-ok({"aa!" ~~ /a/}, '"a" is valid');
lives-ok({"aa!" ~~ /'a'/}, 'quoted "a" is valid');

Expand Down
4 changes: 2 additions & 2 deletions S05-syntactic-categories/new-symbols.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ plan 8;
augment slang Regex {
token backslash:sym<Y> { YY };
}
eval-dies-ok '/foo \y/',
throws-like '/foo \y/', X::AdHoc,
'can not compile regex with unknown backslash rule';
eval-lives-ok '/fuu \Y/', 'can compile a regex with new backslash rule';
ok 'YY' ~~ /^\Y$/, 'can use that rule (positive)';
ok 'yX' !~~ /^\Y$/, 'can use that rule (negative)';
}
#?rakudo skip "RT #126142 - NYI"
eval-dies-ok '/\Y/', 'backslash rules are lexically scoped';
throws-like '/\Y/', X::AdHoc, 'backslash rules are lexically scoped';

#?rakudo skip "RT #126142 - NYI"
{
Expand Down
2 changes: 1 addition & 1 deletion S06-multi/proto.t
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ multi bar(| where { $_[0] == 42 }) { 1 } #OK not used
is(bar(A.new), 2, 'dispatch on class worked (anon cap)');
is(bar(B.new), 3, 'dispatch on class worked (anon cap)');
is(bar(42), 1, 'dispatch with no possible candidates fell back to proto (anon cap)');
eval-dies-ok 'bar(41)', 'impossible dispatch failed (anon cap)';
throws-like 'bar(41)', X::AdHoc, 'impossible dispatch failed (anon cap)';

# RT #65322
{
Expand Down
8 changes: 4 additions & 4 deletions S06-signature/closure-parameters.t
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ plan 17;
my sub test-but-dont-call(&testcode:(Int)) { True }

ok(testit(&testint), 'code runs with proper signature (1)');
eval-dies-ok('testit(&teststr)', 'code dies with invalid signature (1)');
throws-like 'testit(&teststr)', X::AdHoc, 'code dies with invalid signature (1)';

ok(test-but-dont-call(&testint), 'code runs with proper signature (1)');
eval-dies-ok('test-but-dont-call(&teststr)', 'code dies with invalid signature (1)');
throws-like 'test-but-dont-call(&teststr)', X::AdHoc, 'code dies with invalid signature (1)';
}

{
Expand All @@ -41,8 +41,8 @@ plan 17;

ok(testit(&testintbool), 'code runs with proper signature (2)');
eval-dies-ok('testit(&testintint)', 'code dies with invalid signature (2)');
eval-dies-ok('testit(&teststrbool)', 'code dies with invalid signature (3)');
eval-dies-ok('testit(&teststrint)', 'code dies with invalid signature (4)');
throws-like 'testit(&teststrbool)', X::AdHoc, 'code dies with invalid signature (3)';
throws-like 'testit(&teststrint)', X::AdHoc, 'code dies with invalid signature (4)';
}

#?rakudo skip 'subsignatures dont factor into multi candidates yet RT #124935'
Expand Down
6 changes: 3 additions & 3 deletions S06-signature/multiple-signatures.t
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ plan 11;
# L<S13/Syntax/"must all bind the same set of formal variable names">

{
eval-dies-ok q[ multi sub x ($x, $y) | ($x, $y, $z) { 1 }],
throws-like q[ multi sub x ($x, $y) | ($x, $y, $z) { 1 }], X::AdHoc,
'multis with multiple sigs must have the same set of formal variables';
eval-dies-ok q[ multi sub x ($x, $y) | ($x, @y) { 1 }],
throws-like q[ multi sub x ($x, $y) | ($x, @y) { 1 }], X::AdHoc,
'multis with multiple sigs must have the same set of formal variables';
}

# common sense
eval-dies-ok q[ only sub y (Int $x, Str $y) | (Str $x, Int $y) ],
throws-like q[ only sub y (Int $x, Str $y) | (Str $x, Int $y) ], X::AdHoc,
'and "only" sub can not have multiple signatures';

# vim: ft=perl6
12 changes: 6 additions & 6 deletions S10-packages/basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ is Simple::Bar.new.baz, 'hi', 'class test';

# change to match likely error (top of file) when passes
{
eval-dies-ok 'ThisEmpty::no_such_sub()', 'Non-existent sub through package';
throws-like 'ThisEmpty::no_such_sub()', X::AdHoc, 'Non-existent sub through package';
}

# Not sure whether you should be able to access something in package this way
Expand Down Expand Up @@ -169,10 +169,10 @@ eval-lives-ok q' module MapTester { (1, 2, 3).map: { $_ } } ',
X::Redeclaration, 'sub redefined in package dies';
throws-like q[module M { sub m { say "m" }; sub m { say "m" } }],
X::Redeclaration, 'sub redefined in module dies';
eval-dies-ok q[grammar B { token b { 'b' }; token b { 'b' } };],
'token redefined in grammar dies';
eval-dies-ok q[class C { method c { say "c" }; method c { say "c" } }],
'method redefined in class dies';
throws-like q[grammar B { token b { 'b' }; token b { 'b' } };],
X::AdHoc, 'token redefined in grammar dies';
throws-like q[class C { method c { say "c" }; method c { say "c" } }],
X::AdHoc, 'method redefined in class dies';
}

{
Expand Down Expand Up @@ -212,7 +212,7 @@ eval-lives-ok q' module MapTester { (1, 2, 3).map: { $_ } } ',
# package Foo; is perl 5 code;
# RT #75458
{
eval-dies-ok "package Perl5Code;\n'this is Perl 5 code'",
throws-like "package Perl5Code;\n'this is Perl 5 code'", X::AdHoc,
'package Foo; is indicator for Perl 5 code';
}

Expand Down
2 changes: 1 addition & 1 deletion S11-modules/importing.t
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dies-ok( { EVAL '&foo' }, 'Foo::foo is undefined in outer scope' );

}

eval-dies-ok 'use t::spec::packages::S11-modules::Foo :NoSucTag;',
throws-like 'use t::spec::packages::S11-modules::Foo :NoSucTag;', X::AdHoc,
'die while trying to import a non-existent export tag';

# vim: ft=perl6
5 changes: 3 additions & 2 deletions S12-attributes/instance.t
Original file line number Diff line number Diff line change
Expand Up @@ -632,11 +632,12 @@ is Foo7e.new.attr, 42, "default attribute value (1)";
}

# RT #108670
eval-dies-ok 'my class AccessorClash { has @.a; has &.a }',
throws-like 'my class AccessorClash { has @.a; has &.a }', X::AdHoc,
'cannot have two attributes with same accessor name';
# RT #74274
eval-dies-ok q[class A { has $!a }; my $a = A.new(a => 42);
throws-like q[class RT74274 { has $!a }; my $a = RT74274.new(a => 42);
my $method = method { return $!a }; $a.$method()],
X::AdHoc,
'cannot sneak in access to private attribute through the backdoor';

# RT #74636
Expand Down
2 changes: 1 addition & 1 deletion S12-class/augment-supersede.t
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ eval-lives-ok q[
}

my $o = Bar.new;
eval-dies-ok('$o.c', 'overridden method is gone completely');
throws-like '$o.c', X::AdHoc, 'overridden method is gone completely';
is($o.d, 'called Bar.d', 'new method is present instead');
}

Expand Down
4 changes: 2 additions & 2 deletions S12-class/basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ eval-lives-ok q[BEGIN {class Level1::Level2::Level3 {};}; class Level1::Level2 {
}

# RT #64686
eval-dies-ok 'class Romeo::Tango {}; Romeo::Juliet.rt64686',
'call to missing method in A::B dies after class A::C defined';
throws-like 'class Romeo::Tango {}; Romeo::Juliet.rt64686', X::AdHoc,
'call to method in undeclared A::B dies after class A::C defined';

# RT 72286
throws-like 'class WritableSelf { method f { self = 5 } }; WritableSelf.new.f',
Expand Down
Loading

0 comments on commit a7b77c2

Please sign in to comment.