require Config; import Config;
}
-use Test::More tests => 16;
+use Test::More tests => 15;
# open::import expects 'open' as its first argument, but it clashes with open()
sub import {
'hint bits should not be set in $^H before open import' );
# prevent it from loading I18N::Langinfo, so we can test encoding failures
-{
- local @INC;
- $ENV{LC_ALL} = $ENV{LANG} = '';
- eval { import( 'IN', 'locale' ) };
- like( $@, qr/Cannot figure out an encoding/,
- 'no encoding should be found without $ENV{LANG} or $ENV{LC_ALL}' );
-}
-
my $warn;
local $SIG{__WARN__} = sub {
$warn .= shift;
SKIP: {
skip("no perlio, no :utf8", 4) unless $Config{'useperlio'};
+ eval <<EOE;
use open ':utf8';
open(O, ">utf8");
print O chr(0x100);
open(I, "<utf8");
is(ord(<I>), 0x100, ":utf8 single wide character round-trip");
close I;
+EOE
open F, ">a";
@a = map { chr(1 << ($_ << 2)) } 0..5; # 0x1, 0x10, .., 0x100000
like( $@, qr/too ambiguous/, 'should die with ambiguous locale encoding' );
%%%
# the special :locale layer
-$ENV{LANG} = 'ru_RU.KOI8-R';
+$ENV{LC_ALL} = $ENV{LANG} = 'ru_RU.KOI8-R';
# the :locale will probe the locale environment variables like LANG
use open OUT => ':locale';
open(O, ">koi8");