summaryrefslogtreecommitdiff
path: root/t/lib/warnings/mg
blob: 7fdefc26b303ec24fb4246b24e293629784dd5bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
  mg.c	AOK

  No such signal: SIG%s
    $SIG{FRED} = sub {}

  Setting $/ to a reference to zero as a form of slurp is deprecated, treating as undef. This will be fatal in Perl 5.28

  SIG%s handler \"%s\" not defined.
    $SIG{"INT"} = "ok3"; kill "INT",$$;

__END__
# mg.c
use warnings 'signal' ;
$SIG{FRED} = sub {};
EXPECT
No such signal: SIGFRED at - line 3.
########
# mg.c
no warnings 'signal' ;
$SIG{FRED} = sub {};
EXPECT

########
-w
# warnable code, warnings enabled via command line switch
$/ = \0;
EXPECT
Setting $/ to a reference to zero as a form of slurp is deprecated, treating as undef. This will be fatal in Perl 5.28 at - line 3.
########
-w
# warnable code, warnings enabled via command line switch
$/ = \-1;
EXPECT
Setting $/ to a reference to a negative integer as a form of slurp is deprecated, treating as undef. This will be fatal in Perl 5.28 at - line 3.
########
$/ = \-1;
no warnings 'deprecated';
$/ = \-1;
EXPECT
Setting $/ to a reference to a negative integer as a form of slurp is deprecated, treating as undef. This will be fatal in Perl 5.28 at - line 1.
########
# mg.c
use warnings 'signal' ;
if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') {
    print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit;
}
$|=1;
$SIG{"INT"} = "fred"; kill "INT",$$;
EXPECT
SIGINT handler "fred" not defined.
########
# mg.c
no warnings 'signal' ;
if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') {
    print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit;
}
$|=1;
$SIG{"INT"} = "fred"; kill "INT",$$;
EXPECT

########
# mg.c
use warnings 'signal' ;
if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') {
    print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit;
}
$|=1;
$SIG{__WARN__} = sub { warn shift =~ s/\0/\\0/rugs };
$SIG{"INT"} = "fr\0d"; kill "INT",$$;
EXPECT
SIGINT handler "fr\0d" not defined.
########
# mg.c
use warnings 'signal' ;
use open ":std", ":utf8";
use utf8;
if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') {
    print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit;
}
$|=1;
$SIG{"INT"} = "프레드"; kill "INT",$$;
EXPECT
SIGINT handler "프레드" not defined.
########
# mg.c
use warnings 'uninitialized';
'foo' =~ /(foo)/;
oct $3;
EXPECT
Use of uninitialized value $3 in oct at - line 4.
########
# mg.c
use warnings 'uninitialized';
oct $3;
EXPECT
Use of uninitialized value $3 in oct at - line 3.
########
# mg.c
use warnings 'uninitialized';
$ENV{FOO} = undef; # should not warn
EXPECT
########
${^ENCODING} = 42;
{ local ${^ENCODING}; }
${^ENCODING} = undef;
{ local ${^ENCODING} = 37; }
no warnings 'deprecated';
${^ENCODING} = 42;
{ local ${^ENCODING}; }
${^ENCODING} = undef;
{ local ${^ENCODING} = 37; }
EXPECT
${^ENCODING} is no longer supported. Its use will be fatal in Perl 5.28 at - line 1.
${^ENCODING} is no longer supported. Its use will be fatal in Perl 5.28 at - line 4.