issue208.t 782 B

123456789101112131415161718192021
  1. #! /usr/bin/env perl
  2. # http://code.google.com/p/perl-compiler/issues/detail?id=208
  3. # missing DESTROY call at DESTRUCT time
  4. use strict;
  5. BEGIN {
  6. unshift @INC, 't';
  7. require "test.pl";
  8. }
  9. use Test::More tests => 2;
  10. my $script = <<'EOF';
  11. sub MyKooh::DESTROY { print "${^GLOBAL_PHASE} MyKooh " } my $k=bless {}, MyKooh;
  12. sub OurKooh::DESTROY { print "${^GLOBAL_PHASE} OurKooh" } our $k=bless {}, OurKooh;
  13. EOF
  14. my $expected = ($] >= 5.014 ? 'RUN MyKooh DESTRUCT OurKooh' : ' MyKooh OurKooh');
  15. # fixed with 1.42_66, 5.16+5.18
  16. use B::C ();
  17. my $todo = ($] > 5.015 and $B::C::VERSION gt '1.42_65') ? "" : "TODO ";
  18. ctest(1, $expected,'C','ccode208i',$script,$todo.'#208 missing DESTROY call at DESTRUCT time');
  19. ctest(2, $expected,'C,-O3','ccode208i',$script,'TODO #208 -ffast-destruct');