Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added a few tests for suggestion exceptions

  • Loading branch information...
commit f71c502b1a2a08c8a0c020b21f9490fd1cfe4585 1 parent cf4f001
timo timo authored

Showing 1 changed file with 24 additions and 0 deletions. Show diff stats Hide diff stats

  1. +24 0 S32-exceptions/misc.t
24 S32-exceptions/misc.t
@@ -320,4 +320,28 @@ ok $! ~~ X::NoDispatcher, 'nextsame in proto';
320 320 # RT #79162
321 321 throws_like '["a" "b"]', X::Syntax::Confused, reason => 'Two terms in a row';
322 322
  323 +# suggestions
  324 +my $emits_suggestions = False;
  325 +{
  326 + try eval('my $foo = 10; say $Foo');
  327 + $emits_suggestions = True if $!.^can("suggestions");
  328 +}
  329 +
  330 +if $emits_suggestions {
  331 + throws_like 'my $foo = 10; say $Foo;', X::Undeclared, suggestions => '$foo';
  332 + throws_like 'my @barf = 1, 2, 3; say $barf[2]', X::Undeclared, suggestions => '@barf';
  333 +
  334 + throws_like 'my $intergalactic-planetary = "planetary intergalactic"; say $IntergalacticPlanetary', X::Undeclared, suggestions => '$intergalactic-planetary';
  335 +
  336 + throws_like 'class Foo is Junktion {}', X::Inheritance::UnknownParent, suggestions => 'Junction';
  337 + throws_like 'class Bar is junction {}', X::Inheritance::UnknownParent, suggestions => 'Junction';
  338 + throws_like 'class Baz is Juntcion {}', X::Inheritance::UnknownParent, suggestions => 'Junction';
  339 +
  340 + {
  341 + try eval('say huc("foo")');
  342 + ok $! ~~ X::Undeclared::Symbols, "huc throws X::Undeclared::Symbols";
  343 + is $!.routine_suggestion<huc>, ["&uc"], '&uc is a suggestion';
  344 + }
  345 +}
  346 +
323 347 done;

0 comments on commit f71c502

Please sign in to comment.
Something went wrong with that request. Please try again.