This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix test that fails with new warny File::Path
[perl5.git] / t / uni / eval.t
CommitLineData
802a15e9
BF
1#!./perl
2
3# Check if eval correctly ignores the UTF-8 hint.
4
5BEGIN {
b5efbd1f 6 chdir 't' if -d 't';
802a15e9
BF
7 require './test.pl';
8}
9
10plan (tests => 5);
11
12use open qw( :utf8 :std );
13use feature 'unicode_eval';
14
15{
16 my $w;
17 $SIG{__WARN__} = sub { $w = shift };
18 use utf8;
19 my $prog = "qq!\x{f9}!";
20
21 eval $prog;
22 ok !$w;
23
24 $w = "";
25 utf8::upgrade($prog);
26 eval $prog;
27 is $w, '';
28}
29
30{
31 use utf8;
32 isnt eval "q!\360\237\220\252!", eval "q!\x{1f42a}!";
33}
34
35{
36 no utf8; #Let's make real sure.
37 my $not_utf8 = "q!\343\203\213!";
38 isnt eval $not_utf8, eval "q!\x{30cb}!";
39 {
40 use utf8;
41 isnt eval $not_utf8, eval "q!\x{30cb}!";
42 }
43}