issue200.t 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. #! /usr/bin/env perl
  2. # http://code.google.com/p/perl-compiler/issues/detail?id=200
  3. # utf8 hash keys. still broken compile-time on 5.8
  4. use strict;
  5. BEGIN {
  6. unshift @INC, 't';
  7. require "test.pl";
  8. }
  9. use Test::More;
  10. use Config;
  11. if ( $] =~ /^5\.00800[45]/ ) {
  12. plan skip_all => "compile-time utf8 hek hack NYI for $]";
  13. exit;
  14. }
  15. plan tests => 6;
  16. my $i=0;
  17. sub test3 {
  18. my $name = shift;
  19. my $script = shift;
  20. my $cmt = join('',@_);
  21. my $todo = "";
  22. $todo = 'TODO ' if $name eq 'ccode200i_c' or ($] >= 5.018 and $] < 5.019005 and $Config{useithreads});
  23. my $todoc = $] < 5.010 ? "TODO 5.8 " : "";
  24. $todoc = "" if $name eq 'ccode200i_r';
  25. plctestok($i*3+1, $name, $script, $todo." BC $cmt");
  26. ctestok($i*3+2, "C", $name, $script, $todoc."C $cmt");
  27. ctestok($i*3+3, "CC", $name, $script, $todoc."CC $cmt");
  28. $i++;
  29. }
  30. test3('ccode200i_r', '%u=("\x{123}"=>"fo"); print "ok" if $u{"\x{123}"} eq "fo"', 'run-time utf8 hek');
  31. test3('ccode200i_c', 'BEGIN{%u=("\x{123}"=>"fo")} print "ok" if $u{"\x{123}"} eq "fo"', 'compile-time utf8 hek');