issue212.t 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #! /usr/bin/env perl
  2. # http://code.google.com/p/perl-compiler/issues/detail?id=212
  3. # need to share GPs for stashes
  4. use strict;
  5. BEGIN {
  6. unshift @INC, 't';
  7. require "test.pl";
  8. }
  9. use Test::More tests => 3;
  10. use Config ();
  11. use B::C ();
  12. my $ITHREADS = $Config::Config{useithreads};
  13. my $todo1 = ($B::C::VERSION lt '1.45_03' and ($]>=5.018 and $ITHREADS)) ? "TODO 5.18thr ": "";
  14. # fixed with 1.45_04: non-destructive get_isa for 5.8
  15. my $todo3 = ($] < 5.007) ? "TODO 5.6 ": "";
  16. ctestok(1,'C,-O3,-UB','ccode212i',<<'EOF',$todo1.'#212 shared GP');
  17. $blurfl = 123;
  18. {
  19. package abc;
  20. $blurfl = 5;
  21. }
  22. $abc = join(':', sort(keys %abc::));
  23. package abc;
  24. $blurfl;
  25. print q(ok) if eval q/$blurfl/ == 5;
  26. EOF
  27. ctestok(2,'C,-O3,-UB','ccode209i',<<'EOF','#209 empty keys %main::');
  28. $s = join(":", sort(keys %::));
  29. print q(ok) if $s;
  30. EOF
  31. ctestok(3,'C,-O3,-UB','ccode210i',<<'EOF',$todo3.'#210 keys %package return an invalid list');
  32. $a = 123;
  33. package xyz;
  34. sub xsub {bless [];}
  35. $x1 = 1; $x2 = 2;
  36. $s = join(":", sort(keys %xyz::));
  37. package abc;
  38. my $foo;
  39. print q(ok) if $xyz::s eq 's:x1:x2:xsub';
  40. EOF