X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/9612f77d752993595fcf7e3ddafaad50d535f00a..59143e29a717d67a61b869a6c5bb49574f1ef43f:/t/lib/croak/toke diff --git a/t/lib/croak/toke b/t/lib/croak/toke index 0572094..f1817b3 100644 --- a/t/lib/croak/toke +++ b/t/lib/croak/toke @@ -1,4 +1,60 @@ __END__ +# NAME foo found where operator expected +myfunc 1,2,3 +EXPECT +Number found where operator expected at - line 1, near "myfunc 1" + (Do you need to predeclare myfunc?) +syntax error at - line 1, near "myfunc 1" +Execution of - aborted due to compilation errors. +######## +# NAME foo found where operator expected (after strict error, w/fatal warnings) +use warnings FATAL => 'all'; +use strict; +$foo; +myfunc 1,2,3 +EXPECT +Global symbol "$foo" requires explicit package name (did you forget to declare "my $foo"?) at - line 3. +Number found where operator expected at - line 4, near "myfunc 1" + (Do you need to predeclare myfunc?) +syntax error at - line 4, near "myfunc 1" +Execution of - aborted due to compilation errors. +######## +# NAME (Missing operator before ${?) [perl #123737] +0${ +EXPECT +Scalar found where operator expected at - line 1, near "0${" + (Missing operator before ${?) +syntax error at - line 1, near "0$" +Missing right curly or square bracket at - line 1, at end of line +Execution of - aborted due to compilation errors. +######## +# NAME (Missing operator before $#{?) [perl #123737] +0$#{ +EXPECT +Array length found where operator expected at - line 1, near "0$#{" + (Missing operator before $#{?) +syntax error at - line 1, near "0$#" +Missing right curly or square bracket at - line 1, at end of line +Execution of - aborted due to compilation errors. +######## +# NAME (Missing operator before @foo) [perl #123737] +0@foo +EXPECT +Array found where operator expected at - line 1, near "0@foo" + (Missing operator before @foo?) +syntax error at - line 1, near "0@foo +" +Execution of - aborted due to compilation errors. +######## +# NAME (Missing operator before @{) [perl #123737] +0@{ +EXPECT +Array found where operator expected at - line 1, near "0@{" + (Missing operator before @{?) +syntax error at - line 1, near "0@" +Missing right curly or square bracket at - line 1, at end of line +Execution of - aborted due to compilation errors. +######## # NAME Unterminated here-doc in string eval eval "< sub {}; undef *^H } @@ -130,22 +238,122 @@ Constant(qq): Call to &{$^H{qr}} did not return a defined value at - line 3, wit Constant(q): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern Execution of - aborted due to compilation errors. ######## +# NAME Failed constant overloading should not cause a double free +use overload; +BEGIN { overload::constant q => sub {}; undef *^H } +undef(1,2); +undef(1,2); +undef(1,2); +undef(1,2); +undef(1,2); +undef(1,2); +undef(1,2); +undef(1,2); +undef(1,2); +"a" +EXPECT +Too many arguments for undef operator at - line 3, near "2)" +Too many arguments for undef operator at - line 4, near "2)" +Too many arguments for undef operator at - line 5, near "2)" +Too many arguments for undef operator at - line 6, near "2)" +Too many arguments for undef operator at - line 7, near "2)" +Too many arguments for undef operator at - line 8, near "2)" +Too many arguments for undef operator at - line 9, near "2)" +Too many arguments for undef operator at - line 10, near "2)" +Too many arguments for undef operator at - line 11, near "2)" +Constant(q) unknown at - line 12, near ""a"" +- has too many errors. +######## # NAME Unterminated delimiter for here document <<"foo EXPECT Unterminated delimiter for here document at - line 1. ######## -# NAME Unterminated qw// -qw/ +# NAME my (our $x) errors +my (our $x); EXPECT -Can't find string terminator "/" anywhere before EOF at - line 1. +Can't redeclare "our" in "my" at - line 1, near "(our" +Execution of - aborted due to compilation errors. ######## -# NAME Unterminated q// -qw/ +# NAME our (my $x) errors +our (my $x); EXPECT -Can't find string terminator "/" anywhere before EOF at - line 1. +Can't redeclare "my" in "our" at - line 1, near "(my" +Execution of - aborted due to compilation errors. ######## -# NAME Unterminated '' -' +# NAME state (my $x) errors +use feature 'state'; +state (my $x); EXPECT -Can't find string terminator "'" anywhere before EOF at - line 1. +Can't redeclare "my" in "state" at - line 2, near "(my" +Execution of - aborted due to compilation errors. +######## +# NAME our (state $x) errors +use feature 'state'; +our (state $x); +EXPECT +Can't redeclare "state" in "our" at - line 2, near "(state" +Execution of - aborted due to compilation errors. +######## +# NAME my (my $x) errors +my (my $x, $y, $z); +EXPECT +Can't redeclare "my" in "my" at - line 1, near "(my" +Execution of - aborted due to compilation errors. +######## +# NAME our (our $x) errors +our ($x, our($y), $z); +EXPECT +Can't redeclare "our" in "our" at - line 1, near ", our" +Execution of - aborted due to compilation errors. +######## +# NAME state (state $x) errors +use feature 'state'; +state ($x, $y, state $z); +EXPECT +Can't redeclare "state" in "state" at - line 2, near ", state" +Execution of - aborted due to compilation errors. +######## +# NAME BEGIN <> [perl #125341] +BEGIN <> +EXPECT +Illegal declaration of subroutine BEGIN at - line 1. +######## +# NAME multiple conflict markers +<<<<<<< yours:sample.txt +my $some_code; +======= +my $some_other_code; +>>>>>>> theirs:sample.txt +EXPECT +Version control conflict marker at - line 1, near "<<<<<<<" +Version control conflict marker at - line 3, near "=======" +Version control conflict marker at - line 5, near ">>>>>>>" +Execution of - aborted due to compilation errors. +######## +# NAME (Might be a runaway multi-line...) with Latin-1 delimiters in utf8 +BEGIN { binmode STDERR, ':utf8' } +use utf8; +q« +« time +EXPECT +syntax error at - line 4, near "« time" + (Might be a runaway multi-line «« string starting on line 3) +Execution of - aborted due to compilation errors. +######## +# NAME (Might be a runaway multi-line...) with non-Latin-1 delimiters +BEGIN { binmode STDERR, ':utf8' } +use utf8; +q ϡ +ϡ time +EXPECT +syntax error at - line 4, near "ϡ time" + (Might be a runaway multi-line ϡϡ string starting on line 3) +Execution of - aborted due to compilation errors. +######## +# NAME tr/// handling of mis-formatted \o characters +# may only fail with ASAN +tr/\o-0//; +EXPECT +Missing braces on \o{} at - line 2, within string +Execution of - aborted due to compilation errors.