home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / ntcode / ntperlb / t / comp / opts.nt < prev    next >
Encoding:
Text File  |  1995-05-19  |  1.0 KB  |  53 lines

  1.  
  2. print "1..5\n";
  3.  
  4. #
  5. # test -a command line option
  6. #
  7.  
  8. $x = `echo 1 2 3 4 5 | perl -nae 'print ((\$F[4] == 5) ? "ok": "not ok");'`;
  9.  
  10. print $x, " 1\n";
  11.  
  12. $tmp = "foo$$";
  13.  
  14. #
  15. # test the -0 (record terminator) option
  16. #
  17.  
  18. $x = `echo 1 2 3 4 | perl -0040 -l012 -ne 'print;'`;
  19. @x =  $x ne '' ? split ('\n', $x) : ();
  20. if (@x == 4 && $x[0] eq "1") {print "ok 2\n";} else {print "not ok 2\n";}
  21.  
  22. #
  23. # test the -w option
  24. #
  25. open (T, ">$tmp") || die "Can't open $tmp for writing: $!\n";
  26. print T 'print "$^W";';
  27. close T;
  28. $x = `perl -w $tmp`;
  29. unlink $tmp;
  30. if ($x eq "1") {print "ok 3\n";} else {print "not ok 3 ($x)\n";}
  31.  
  32. open (T, ">$tmp") || die "Can't open $tmp for writing: $!\n";
  33. print T '$c = 1;';
  34. close T;
  35. $x = `perl -w $tmp 2>&1`;
  36. unlink $tmp;
  37. if ($x =~ /^Possible typo/) {print "ok 4\n";} else {print "not ok 4\n";}
  38.  
  39. #
  40. # test the -l (line end processing) option
  41. #
  42.  
  43. $x = `perl -l014 -e 'print "ok" if (\$\\ eq "\014");'`;
  44. chop $x;
  45. if ("$x" eq "ok") {print "ok 5\n";} else {print "not ok 5\n";}
  46.  
  47.  
  48. #
  49. # test the -s command line option
  50. #
  51.  
  52.  
  53.