DBM-Deep
view release on metacpan or search on metacpan
t/56_unicode.t view on Meta::CPAN
use strict;
use warnings FATAL => 'all';
use Test::More;
use lib 't';
use common qw( new_dbm );
use utf8;
use DBM::Deep;
my $dbm_factory = new_dbm();
while ( my $dbm_maker = $dbm_factory->() ) {
my $db = $dbm_maker->();
SKIP: {
skip "This engine does not support Unicode", 1
unless $db->supports( 'unicode' );
my $quote
= 'á¼Î³á½³Î½ÎµÏο δὲ λόγῳ μὲν δημοκÏαÏία, λόγῳ δὲ Ïοῦ ÏÏá½½ÏοÏ
á¼Î½Î´Ïá½¸Ï á¼ÏÏá½µ.'
.' âÎοÏ
κÏ
δίδηÏ';
$db->{'ÑÑкÑÑ'} = $quote;
is join("-", keys %$db), 'ÑÑкÑÑ', 'Unicode keys';
is $db->{'ÑÑкÑÑ'}, $quote, 'Unicode values';
{
no warnings 'utf8';
# extra stress test
$db->{"\x{d800}"} = "\x{dc00}";
is join("-", sort keys %$db), "ÑÑкÑÑ-\x{d800}",
'Surrogate keys';
is $db->{"\x{d800}"}, "\x{dc00}", 'Surrogate values';
}
$db->{feen} = "plare\xff";
$db->{feen} = 'pÅare';
is $db->{feen}, 'pÅare', 'values can be upgraded to Unicode';
}
}
done_testing;
( run in 4.105 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )