diff options
Diffstat (limited to 't/uni/opcroak.t')
-rw-r--r-- | t/uni/opcroak.t | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/t/uni/opcroak.t b/t/uni/opcroak.t new file mode 100644 index 0000000000..29909d7cd6 --- /dev/null +++ b/t/uni/opcroak.t @@ -0,0 +1,44 @@ +#!./perl + +# +# tests for op.c generated croaks +# + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; + require './test.pl'; +} + +use utf8; +use open qw( :utf8 :std ); +use warnings; + +plan( tests => 5 ); + +eval qq!sub \x{30cb} (\$) {} \x{30cb}()!; +like $@, qr/Not enough arguments for main::\x{30cb}/u, "Not enough arguments croak is UTF-8 clean"; + +eval qq!sub \x{30cc} (\$) {} \x{30cc}(1, 2)!; +like $@, qr/Too many arguments for main::\x{30cc}/u, "Too many arguments croak is UTF-8 clean"; + +eval qq!sub \x{30cd} (\Q\%\E) { 1 } \x{30cd}(1);!; +like $@, qr/Type of arg 1 to main::\x{30cd} must be/u, "bad type croak is UTF-8 clean"; + + eval <<'END_FIELDS'; + { + package FŌŌ { + use fields qw( a b ); + sub new { bless {}, shift } + } + } +END_FIELDS + +for ( + [ element => 'my FŌŌ $bàr = FŌŌ->new; $bàr->{クラス};' ], + [ slice => 'my FŌŌ $bàr = FŌŌ->new; @{$bàr}{ qw( a クラス ) };' ] + ) { + eval $_->[1]; + + like $@, qr/No such class field "クラス" in variable \$bàr of type FŌŌ/, "$_->[0]: no such field error is UTF-8 clean"; +} |