xref: /openbsd/gnu/usr.bin/perl/t/uni/eval.t (revision a6445c1d)
1#!./perl
2
3# Check if eval correctly ignores the UTF-8 hint.
4
5BEGIN {
6    require './test.pl';
7}
8
9plan (tests => 5);
10
11use open qw( :utf8 :std );
12use feature 'unicode_eval';
13
14{
15    my $w;
16    $SIG{__WARN__} = sub { $w = shift };
17    use utf8;
18    my $prog = "qq!\x{f9}!";
19
20    eval $prog;
21    ok !$w;
22
23    $w = "";
24    utf8::upgrade($prog);
25    eval $prog;
26    is $w, '';
27}
28
29{
30    use utf8;
31    isnt eval "q!\360\237\220\252!", eval "q!\x{1f42a}!";
32}
33
34{
35    no utf8; #Let's make real sure.
36    my $not_utf8 = "q!\343\203\213!";
37    isnt eval $not_utf8, eval "q!\x{30cb}!";
38    {
39        use utf8;
40        isnt eval $not_utf8, eval "q!\x{30cb}!";
41    }
42}
43