diff options
author | Brian Fraser <fraserbn@gmail.com> | 2012-03-23 08:50:22 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-03-23 09:30:08 -0700 |
commit | ce16c625ecbfe5ee0a74317b44ba90696fad6e5c (patch) | |
tree | a9c7ae3be8bcb5141778d886759169b60fd1dc8b /t/uni | |
parent | 654dfe5293a435f777e47f6587931541a3006cbd (diff) | |
download | perl-ce16c625ecbfe5ee0a74317b44ba90696fad6e5c.tar.gz |
op.c: Warnings cleanup.
Diffstat (limited to 't/uni')
-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"; +} |