2 use warnings FATAL => 'all';
12 use Function::Parameters qw(:strict);
14 method formalize($text, :$justify = "left", :$case = undef) {
16 $params{text} = $text;
17 $params{justify} = $justify;
18 $params{case} = $case if defined $case;
23 is_deeply( Foo->formalize( "stuff" ), { text => "stuff", justify => "left" } );
25 like exception { Foo->formalize( "stuff", wibble => 23 ) }, qr/\bnamed\b.+\bwibble\b/;
31 is( Foo->foo( arg => 42 ), 42 );
32 like exception { foo() }, qr/Not enough arguments/;
35 # Compile time errors need internal refactoring before I can get file, line and method
38 method wrong( :$named, $pos ) {}
40 like $@, qr/\bpositional\b.+\$pos\b.+\bnamed\b.+\$named\b/;
43 method wrong( $foo, :$named, $bar ) {}
45 like $@, qr/\bpositional\b.+\$bar\b.+\bnamed\b.+\$named\b/;
48 method wrong( $foo, $bar = undef, :$named ) {}
50 like $@, qr/\boptional positional\b.+\$bar\b.+\brequired named\b.+\$named\b/;