xref: /openbsd-src/gnu/usr.bin/perl/t/lib/warnings/mg (revision b8851fcc53cbe24fd20b090f26dd149e353f6174)
1  mg.c	AOK
2
3  No such signal: SIG%s
4    $SIG{FRED} = sub {}
5
6  Setting $/ to a reference to zero as a form of slurp is deprecated, treating as undef
7
8  SIG%s handler \"%s\" not defined.
9    $SIG{"INT"} = "ok3"; kill "INT",$$;
10
11__END__
12# mg.c
13use warnings 'signal' ;
14$SIG{FRED} = sub {};
15EXPECT
16No such signal: SIGFRED at - line 3.
17########
18# mg.c
19no warnings 'signal' ;
20$SIG{FRED} = sub {};
21EXPECT
22
23########
24-w
25# warnable code, warnings enabled via command line switch
26$/ = \0;
27EXPECT
28Setting $/ to a reference to zero as a form of slurp is deprecated, treating as undef at - line 3.
29########
30-w
31# warnable code, warnings enabled via command line switch
32$/ = \-1;
33EXPECT
34Setting $/ to a reference to a negative integer as a form of slurp is deprecated, treating as undef at - line 3.
35########
36$/ = \-1;
37no warnings 'deprecated';
38$/ = \-1;
39EXPECT
40Setting $/ to a reference to a negative integer as a form of slurp is deprecated, treating as undef at - line 1.
41########
42# mg.c
43use warnings 'signal' ;
44if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') {
45    print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit;
46}
47$|=1;
48$SIG{"INT"} = "fred"; kill "INT",$$;
49EXPECT
50SIGINT handler "fred" not defined.
51########
52# mg.c
53no warnings 'signal' ;
54if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') {
55    print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit;
56}
57$|=1;
58$SIG{"INT"} = "fred"; kill "INT",$$;
59EXPECT
60
61########
62# mg.c
63use warnings 'signal' ;
64if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') {
65    print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit;
66}
67$|=1;
68$SIG{__WARN__} = sub { warn shift =~ s/\0/\\0/rugs };
69$SIG{"INT"} = "fr\0d"; kill "INT",$$;
70EXPECT
71SIGINT handler "fr\0d" not defined.
72########
73# mg.c
74use warnings 'signal' ;
75use open ":std", ":utf8";
76use utf8;
77if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') {
78    print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit;
79}
80$|=1;
81$SIG{"INT"} = "프레드"; kill "INT",$$;
82EXPECT
83SIGINT handler "프레드" not defined.
84########
85# mg.c
86use warnings 'uninitialized';
87'foo' =~ /(foo)/;
88oct $3;
89EXPECT
90Use of uninitialized value $3 in oct at - line 4.
91########
92# mg.c
93use warnings 'uninitialized';
94oct $3;
95EXPECT
96Use of uninitialized value $3 in oct at - line 3.
97########
98# mg.c
99use warnings 'uninitialized';
100$ENV{FOO} = undef; # should not warn
101EXPECT
102########
103${^ENCODING} = 42;
104{ local ${^ENCODING}; }
105${^ENCODING} = undef;
106{ local ${^ENCODING} = 37; }
107no warnings 'deprecated';
108${^ENCODING} = 42;
109{ local ${^ENCODING}; }
110${^ENCODING} = undef;
111{ local ${^ENCODING} = 37; }
112EXPECT
113Setting ${^ENCODING} is deprecated at - line 1.
114Setting ${^ENCODING} is deprecated at - line 4.
115