issue51.t 614 B

123456789101112131415161718192021222324252627282930
  1. #! /usr/bin/env perl
  2. # http://code.google.com/p/perl-compiler/issues/detail?id=51
  3. # B:CC errors on nested if statement with test on multiple variables
  4. use Test::More tests => 1;
  5. use strict;
  6. BEGIN {
  7. unshift @INC, 't';
  8. require "test.pl";
  9. }
  10. my $script = <<'EOF';
  11. my ($p1, $p2) = (80, 80);
  12. if ($p1 <= 23 && 23 <= $p2) {
  13. print "telnet\n";
  14. }
  15. elsif ($p1 <= 80 && 80 <= $p2) {
  16. print "http\n";
  17. }
  18. else {
  19. print "fail\n"
  20. }
  21. EOF
  22. use B::CC;
  23. ctest(1, '^http$', "CC", "ccode51i", $script,
  24. $B::CC::VERSION < 1.08
  25. ? "nested if on multiple variables - issue51. Fixed with B-C-1.28 r659"
  26. : undef);