home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / language / perl / Test / T / Op / Magic < prev    next >
Encoding:
Text File  |  1990-11-15  |  789 b   |  33 lines

  1. #!./perl
  2.  
  3. # $Header: op.magic,v 3.0.1.1 89/11/11 05:00:07 lwall Locked $
  4.  
  5. $| = 1;        # command buffering
  6.  
  7. print "1..6\n";
  8.  
  9. eval '$ENV{"foo"} = "hi there";';    # check that ENV is inited inside eval
  10. if (`echo <foo>` eq "hi there\n") {print "ok 1\n";} else {print "not ok 1\n";}
  11. delete $ENV{'foo'};
  12.  
  13. unlink 'asdfghj';
  14. $! = 0;
  15. open(foo,'asdfghj');
  16. if ($! == 214) {print "ok 2\n";} else {print "not ok 2\n";}
  17. $! = 0;
  18. unlink 'asdfghjklpoiuyt';
  19. if ($! == 67788) {print "ok 3\n";} else {print "not ok 3\n";}
  20.  
  21. eval <<'END';
  22.  
  23. $SIG{"INT"} = "ok4"; kill "INT";
  24. $SIG{"INT"} = "IGNORE"; kill "INT"; print "ok 5\n";
  25.  
  26. sub ok4 { print "ok 4\n" if pop(@_) eq "INT"; }
  27. END
  28.  
  29. @val1 = @ENV{keys(%ENV)};    # can we slice ENV?
  30. @val2 = values(%ENV);
  31.  
  32. print join(':',@val1) eq join(':',@val2) ? "ok 6\n" : "not ok 6\n";
  33.