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