home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / perl / Perl / t / base / lex.t < prev    next >
Encoding:
Text File  |  1994-10-18  |  1.5 KB  |  92 lines

  1. #!./perl
  2.  
  3. # $RCSfile: lex.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:04 $
  4.  
  5. print "1..24\n";
  6.  
  7. $x = 'x';
  8.  
  9. print "#1    :$x: eq :x:\n";
  10. if ($x eq 'x') {print "ok 1\n";} else {print "not ok 1\n";}
  11.  
  12. $x = $#;    # this is the register $#
  13.  
  14. if ($x eq '') {print "ok 2\n";} else {print "not ok 2\n";}
  15.  
  16. $x = $#x;
  17.  
  18. if ($x eq '-1') {print "ok 3\n";} else {print "not ok 3\n";}
  19.  
  20. $x = '\\'; # ';
  21.  
  22. if (length($x) == 1) {print "ok 4\n";} else {print "not ok 4\n";}
  23.  
  24. eval 'while (0) {
  25.     print "foo\n";
  26. }
  27. /^/ && (print "ok 5\n");
  28. ';
  29.  
  30. eval '$foo{1} / 1;';
  31. if (!$@) {print "ok 6\n";} else {print "not ok 6 $@\n";}
  32.  
  33. eval '$foo = 123+123.4+123e4+123.4E5+123.4e+5+.12;';
  34.  
  35. $foo = int($foo * 100 + .5);
  36. if ($foo eq 2591024652) {print "ok 7\n";} else {print "not ok 7 :$foo:\n";}
  37.  
  38. print <<'EOF';
  39. ok 8
  40. EOF
  41.  
  42. $foo = 'ok 9';
  43. print <<EOF;
  44. $foo
  45. EOF
  46.  
  47. eval <<\EOE, print $@;
  48. print <<'EOF';
  49. ok 10
  50. EOF
  51.  
  52. $foo = 'ok 11';
  53. print <<EOF;
  54. $foo
  55. EOF
  56. EOE
  57.  
  58. print <<`EOS` . <<\EOF;
  59. echo ok 12
  60. EOS
  61. ok 13
  62. EOF
  63.  
  64. print qq/ok 14\n/;
  65. print qq(ok 15\n);
  66.  
  67. print qq
  68. [ok 16\n]
  69. ;
  70.  
  71. print q<ok 17
  72. >;
  73.  
  74. print <<;   # Yow!
  75. ok 18
  76.  
  77. # previous line intentionally left blank.
  78.  
  79. $foo = FOO;
  80. $bar = BAR;
  81. $foo{$bar} = BAZ;
  82. $ary[0] = ABC;
  83.  
  84. print "$foo{$bar}" eq "BAZ" ? "ok 19\n" : "not ok 19\n";
  85.  
  86. print "${foo}{$bar}" eq "FOO{BAR}" ? "ok 20\n" : "not ok 20\n";
  87. print "${foo{$bar}}" eq "BAZ" ? "ok 21\n" : "not ok 21\n";
  88.  
  89. print "FOO:" =~ /$foo[:]/ ? "ok 22\n" : "not ok 22\n";
  90. print "ABC" =~ /^$ary[$A]$/ ? "ok 23\n" : "not ok 23\n";
  91. print "FOOZ" =~ /^$foo[$A-Z]$/ ? "ok 24\n" : "not ok 24\n";
  92.