issue172.t 726 B

123456789101112131415161718192021222324
  1. #! /usr/bin/env perl
  2. # http://code.google.com/p/perl-compiler/issues/detail?id=172
  3. # miss to mark empty overloaded package
  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. package Foo;
  12. use overload q("") => sub { "Foo" };
  13. package main;
  14. my $foo = bless {}, "Foo";
  15. print "ok\n" if "$foo" eq "Foo";
  16. print "$foo\n";
  17. EOF
  18. # fixed with 1.42_67 but not in 5.18 yet
  19. use B::C ();
  20. my $todo = ($B::C::VERSION ge '1.42_67' and $] < 5.018) ? "" : "TODO ";
  21. ctest(1, "ok\nFoo",'C','ccode172i',$script,$todo.'#172 miss to mark empty overloaded package');
  22. ctest(2, "ok\nFoo",'C,-uFoo','ccode172i',$script,($] < 5.018 ? '':"TODO 5.18 ").'#172 -uFoo includes overloaded package');