sync a bunch of files with Test::Simple 0.86
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / utf8.t
1 #!/usr/bin/perl -w
2 # $Id$
3
4 BEGIN {
5     if( $ENV{PERL_CORE} ) {
6         chdir 't';
7         @INC = '../lib';
8     }
9 }
10
11 use strict;
12 use warnings;
13
14 use Test::More skip_all => 'Not yet implemented';
15
16 my $have_perlio;
17 BEGIN {
18     # All together so Test::More sees the open discipline
19     $have_perlio = eval q[
20         use PerlIO;
21         use open ':std', ':locale';
22         use Test::More;
23         1;
24     ];
25 }
26
27 use Test::More;
28
29 if( !$have_perlio ) {
30     plan skip_all => "Don't have PerlIO";
31 }
32 else {
33     plan tests => 5;
34 }
35
36 SKIP: {
37     skip( "Need PerlIO for this feature", 3 )
38         unless $have_perlio;
39
40     my %handles = (
41         output          => \*STDOUT,
42         failure_output  => \*STDERR,
43         todo_output     => \*STDOUT
44     );
45
46     for my $method (keys %handles) {
47         my $src = $handles{$method};
48         
49         my $dest = Test::More->builder->$method;
50         
51         is_deeply { map { $_ => 1 } PerlIO::get_layers($dest) },
52                   { map { $_ => 1 } PerlIO::get_layers($src)  },
53                   "layers copied to $method";
54     }
55 }
56
57 SKIP: {
58     skip( "Can't test in general because their locale is unknown", 2 )
59         unless $ENV{AUTHOR_TESTING};
60
61     my $uni = "\x{11e}";
62     
63     my @warnings;
64     local $SIG{__WARN__} = sub {
65         push @warnings, @_;
66     };
67
68     is( $uni, $uni, "Testing $uni" );
69     is_deeply( \@warnings, [] );
70 }