Commit | Line | Data |
---|---|---|
c271df94 BF |
1 | #!./perl -w |
2 | ||
3 | BEGIN { | |
b5efbd1f | 4 | chdir 't' if -d 't'; |
c271df94 BF |
5 | require './test.pl'; |
6 | } | |
7 | ||
8 | plan tests => 4; | |
9 | ||
10 | use utf8; | |
11 | use open qw( :utf8 :std ); | |
12 | ||
13 | sub goto_baresub { | |
14 | goto &問題の原因; | |
15 | } | |
16 | ||
17 | sub goto_softref { | |
18 | goto &{"問題の原因"}; | |
19 | } | |
20 | ||
21 | sub goto_softref_octal { | |
22 | goto &{"\345\225\217\351\241\214\343\201\256\345\216\237\345\233\240"}; | |
23 | } | |
24 | ||
25 | sub 問題の原因 { | |
26 | 1; | |
27 | } | |
28 | ||
29 | ok goto_baresub(), "Magical goto works on an UTF-8 sub,"; | |
30 | ok goto_softref(), "..and an UTF-8 softref sub,"; | |
31 | ||
32 | { | |
33 | local $@; | |
34 | eval { goto_softref_octal() }; | |
35 | 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"; | |
36 | } | |
37 | ||
38 | { | |
39 | local $@; | |
40 | eval { goto &因 }; | |
41 | like $@, qr/Goto undefined subroutine &main::因/, "goto undefined sub gets the right error message"; | |
42 | } |