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