summaryrefslogtreecommitdiff
path: root/cpan/Test-Simple/t/Legacy/utf8.t
diff options
context:
space:
mode:
authorChad Granum <chad.granum@dreamhost.com>2014-10-23 12:03:23 -0700
committerJames E Keenan <jkeenan@cpan.org>2014-10-26 11:59:40 -0400
commit07308ed1589cc2f7837b5d3a1303d200a49b9338 (patch)
treed3fd48fe8ab2e8f8432c5b7a429a41d715301bff /cpan/Test-Simple/t/Legacy/utf8.t
parentb17645516d4569fdfc26a2ed61c6e8704ced92cf (diff)
downloadperl-07308ed1589cc2f7837b5d3a1303d200a49b9338.tar.gz
Import Test-More 1.301001 alpha 63
Diffstat (limited to 'cpan/Test-Simple/t/Legacy/utf8.t')
-rw-r--r--cpan/Test-Simple/t/Legacy/utf8.t67
1 files changed, 67 insertions, 0 deletions
diff --git a/cpan/Test-Simple/t/Legacy/utf8.t b/cpan/Test-Simple/t/Legacy/utf8.t
new file mode 100644
index 0000000000..2930226e3e
--- /dev/null
+++ b/cpan/Test-Simple/t/Legacy/utf8.t
@@ -0,0 +1,67 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = '../lib';
+ }
+}
+
+use strict;
+use warnings;
+
+my $have_perlio;
+BEGIN {
+ # All together so Test::More sees the open discipline
+ $have_perlio = eval q[
+ require PerlIO;
+ binmode *STDOUT, ":encoding(utf8)";
+ binmode *STDERR, ":encoding(utf8)";
+ require Test::More;
+ 1;
+ ];
+}
+
+use Test::More;
+
+if( !$have_perlio ) {
+ plan skip_all => "Don't have PerlIO";
+}
+else {
+ plan tests => 5;
+}
+
+SKIP: {
+ skip( "Need PerlIO for this feature", 3 )
+ unless $have_perlio;
+
+ my %handles = (
+ output => \*STDOUT,
+ failure_output => \*STDERR,
+ todo_output => \*STDOUT
+ );
+
+ for my $method (keys %handles) {
+ my $src = $handles{$method};
+
+ my $dest = Test::More->builder->$method;
+
+ is_deeply { map { $_ => 1 } PerlIO::get_layers($dest) },
+ { map { $_ => 1 } PerlIO::get_layers($src) },
+ "layers copied to $method";
+ }
+}
+
+
+# Test utf8 is ok.
+{
+ my $uni = "\x{11e}";
+
+ my @warnings;
+ local $SIG{__WARN__} = sub {
+ push @warnings, @_;
+ };
+
+ is( $uni, $uni, "Testing $uni" );
+ is_deeply( \@warnings, [] );
+}