summaryrefslogtreecommitdiff
path: root/t/op.magic
diff options
context:
space:
mode:
Diffstat (limited to 't/op.magic')
-rw-r--r--t/op.magic31
1 files changed, 15 insertions, 16 deletions
diff --git a/t/op.magic b/t/op.magic
index 7696803127..ab8dbeec3d 100644
--- a/t/op.magic
+++ b/t/op.magic
@@ -1,27 +1,26 @@
#!./perl
-# $Header: op.magic,v 1.0 87/12/18 13:13:54 root Exp $
-
-print "1..4\n";
+# $Header: op.magic,v 2.0 88/06/05 00:14:11 root Exp $
$| = 1; # command buffering
-$ENV{'foo'} = 'hi there';
+print "1..4\n";
+
+eval '$ENV{"foo"} = "hi there";'; # check that ENV is inited inside eval
if (`echo \$foo` eq "hi there\n") {print "ok 1\n";} else {print "not ok 1\n";}
$! = 0;
open(foo,'ajslkdfpqjsjfkslkjdflksd');
if ($! == 2) {print "ok 2\n";} else {print "not ok 2\n";}
-$SIG{'INT'} = 'ok3';
-kill 2,$$;
-$SIG{'INT'} = 'IGNORE';
-kill 2,$$;
-print "ok 4\n";
-$SIG{'INT'} = 'DEFAULT';
-kill 2,$$;
-print "not ok\n";
-
-sub ok3 {
- print "ok 3\n" if pop(@_) eq 'INT';
-}
+# the next tests are embedded inside system simply because sh spits out
+# a newline onto stderr when a child process kills itself with SIGINT.
+
+system './perl',
+'-e', '$| = 1; # command buffering',
+
+'-e', '$SIG{"INT"} = "ok3"; kill 2,$$;',
+'-e', '$SIG{"INT"} = "IGNORE"; kill 2,$$; print "ok 4\n";',
+'-e', '$SIG{"INT"} = "DEFAULT"; kill 2,$$; print "not ok\n";',
+
+'-e', 'sub ok3 { print "ok 3\n" if pop(@_) eq "INT"; }';