This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Get t/uni/cache.t working under minitest
[perl5.git] / t / uni / goto.t
1 #!./perl -w
2
3 BEGIN {
4     require './test.pl';
5 }
6
7 plan tests => 4;
8
9 use utf8;
10 use open qw( :utf8 :std );
11
12 sub goto_baresub {
13     goto &問題の原因;
14 }
15
16 sub goto_softref {
17     goto &{"問題の原因"};
18 }
19
20 sub goto_softref_octal {
21     goto &{"\345\225\217\351\241\214\343\201\256\345\216\237\345\233\240"};
22 }
23
24 sub 問題の原因 {
25     1;
26 }
27
28 ok goto_baresub(), "Magical goto works on an UTF-8 sub,";
29 ok goto_softref(), "..and an UTF-8 softref sub,";
30
31 {
32     local $@;
33     eval { goto_softref_octal() };
34     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";
35 }
36
37 {
38     local $@;
39     eval { goto &因 };
40     like $@, qr/Goto undefined subroutine &main::因/, "goto undefined sub gets the right error message";
41 }