home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl560.zip / t / comp / bproto.t next >
Text File  |  1999-12-08  |  696b  |  45 lines

  1. #!./perl
  2. #
  3. # check if builtins behave as prototyped
  4. #
  5.  
  6. BEGIN {
  7.     chdir 't' if -d 't';
  8.     unshift @INC, '../lib';
  9. }
  10.  
  11. print "1..10\n";
  12.  
  13. my $i = 1;
  14.  
  15. sub foo {}
  16. my $bar = "bar";
  17.  
  18. sub test_too_many {
  19.     eval $_[0];
  20.     print "not " unless $@ =~ /^Too many arguments/;
  21.     printf "ok %d\n",$i++;
  22. }
  23.  
  24. sub test_no_error {
  25.     eval $_[0];
  26.     print "not " if $@;
  27.     printf "ok %d\n",$i++;
  28. }
  29.  
  30. test_too_many($_) for split /\n/,
  31. q[    defined(&foo, $bar);
  32.     undef(&foo, $bar);
  33.     uc($bar,$bar);
  34. ];
  35.  
  36. test_no_error($_) for split /\n/,
  37. q[    scalar(&foo,$bar);
  38.     defined &foo, &foo, &foo;
  39.     undef &foo, $bar;
  40.     uc $bar,$bar;
  41.     grep(not($bar), $bar);
  42.     grep(not($bar, $bar), $bar);
  43.     grep((not $bar, $bar, $bar), $bar);
  44. ];
  45.