summaryrefslogtreecommitdiff
path: root/t/uni
diff options
context:
space:
mode:
authorBrian Fraser <fraserbn@gmail.com>2011-07-22 09:51:03 -0300
committerFather Chrysostomos <sprout@cpan.org>2011-10-06 13:01:05 -0700
commitc271df943c312e7d6e9102703218e7253282f35e (patch)
tree5274f422eab9ea61a8823377b97e01a8bd002165 /t/uni
parentc8416c26ff9b40a27db1eddcb4f7dad8e7745e93 (diff)
downloadperl-c271df943c312e7d6e9102703218e7253282f35e.tar.gz
pp_ctl.c: pp_goto UTF8 cleanup.
Diffstat (limited to 't/uni')
-rw-r--r--t/uni/goto.t41
1 files changed, 41 insertions, 0 deletions
diff --git a/t/uni/goto.t b/t/uni/goto.t
new file mode 100644
index 0000000000..922ddc15d9
--- /dev/null
+++ b/t/uni/goto.t
@@ -0,0 +1,41 @@
+#!./perl -w
+
+BEGIN {
+ require './test.pl';
+}
+
+plan tests => 4;
+
+use utf8;
+use open qw( :utf8 :std );
+
+sub goto_baresub {
+ goto &問題の原因;
+}
+
+sub goto_softref {
+ goto &{"問題の原因"};
+}
+
+sub goto_softref_octal {
+ goto &{"\345\225\217\351\241\214\343\201\256\345\216\237\345\233\240"};
+}
+
+sub 問題の原因 {
+ 1;
+}
+
+ok goto_baresub(), "Magical goto works on an UTF-8 sub,";
+ok goto_softref(), "..and an UTF-8 softref sub,";
+
+{
+ local $@;
+ eval { goto_softref_octal() };
+ like $@, qr/Goto undefined subroutine &main::\345\225\217\351\241\214\343\201\256\345\216\237\345\233\240/, "But does NOT find the softref sub when it's lacking the UTF-8 flag";
+}
+
+{
+ local $@;
+ eval { goto &因 };
+ like $@, qr/Goto undefined subroutine &main::因/, "goto undefined sub gets the right error message";
+}