perl 4.0 patch 36: (combined patch)
[p5sagit/p5-mst-13.2.git] / t / op / magic.t
CommitLineData
8d063cd8 1#!./perl
2
fe14fcc3 3# $Header: magic.t,v 4.0 91/03/20 01:53:35 lwall Locked $
8d063cd8 4
5$| = 1; # command buffering
6
a687059c 7print "1..5\n";
378cc40b 8
9eval '$ENV{"foo"} = "hi there";'; # check that ENV is inited inside eval
8d063cd8 10if (`echo \$foo` eq "hi there\n") {print "ok 1\n";} else {print "not ok 1\n";}
11
bf38876a 12unlink 'ajslkdfpqjsjfk';
8d063cd8 13$! = 0;
bf38876a 14open(foo,'ajslkdfpqjsjfk');
8d063cd8 15if ($! == 2) {print "ok 2\n";} else {print "not ok 2\n";}
16
378cc40b 17# the next tests are embedded inside system simply because sh spits out
18# a newline onto stderr when a child process kills itself with SIGINT.
19
20system './perl',
21'-e', '$| = 1; # command buffering',
22
23'-e', '$SIG{"INT"} = "ok3"; kill 2,$$;',
24'-e', '$SIG{"INT"} = "IGNORE"; kill 2,$$; print "ok 4\n";',
25'-e', '$SIG{"INT"} = "DEFAULT"; kill 2,$$; print "not ok\n";',
26
27'-e', 'sub ok3 { print "ok 3\n" if pop(@_) eq "INT"; }';
a687059c 28
29@val1 = @ENV{keys(%ENV)}; # can we slice ENV?
30@val2 = values(%ENV);
31
32print join(':',@val1) eq join(':',@val2) ? "ok 5\n" : "not ok 5\n";