summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/Encode
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2013-03-25 20:06:16 +0000
committersthen <sthen@openbsd.org>2013-03-25 20:06:16 +0000
commit898184e3e61f9129feb5978fad5a8c6865f00b92 (patch)
tree56f32aefc1eed60b534611007c7856f82697a205 /gnu/usr.bin/perl/cpan/Encode
parentPGSHIFT -> PAGE_SHIFT (diff)
downloadwireguard-openbsd-898184e3e61f9129feb5978fad5a8c6865f00b92.tar.xz
wireguard-openbsd-898184e3e61f9129feb5978fad5a8c6865f00b92.zip
import perl 5.16.3 from CPAN - worked on by Andrew Fresh and myself
Diffstat (limited to 'gnu/usr.bin/perl/cpan/Encode')
-rw-r--r--gnu/usr.bin/perl/cpan/Encode/MANIFEST1
-rw-r--r--gnu/usr.bin/perl/cpan/Encode/META.yml4
-rwxr-xr-xgnu/usr.bin/perl/cpan/Encode/t/Aliases.t38
-rwxr-xr-xgnu/usr.bin/perl/cpan/Encode/t/guess.t12
-rw-r--r--gnu/usr.bin/perl/cpan/Encode/t/utf8ref.t20
-rwxr-xr-xgnu/usr.bin/perl/cpan/Encode/t/utf8strict.t5
6 files changed, 65 insertions, 15 deletions
diff --git a/gnu/usr.bin/perl/cpan/Encode/MANIFEST b/gnu/usr.bin/perl/cpan/Encode/MANIFEST
index 48fa14353c7..3fe6582a22b 100644
--- a/gnu/usr.bin/perl/cpan/Encode/MANIFEST
+++ b/gnu/usr.bin/perl/cpan/Encode/MANIFEST
@@ -97,6 +97,7 @@ t/perlio.t test script
t/piconv.t test script
t/rt.pl even more test script
t/unibench.pl benchmark script
+t/utf8ref.t test script
t/utf8strict.t test script
ucm/8859-1.ucm Unicode Character Map
ucm/8859-10.ucm Unicode Character Map
diff --git a/gnu/usr.bin/perl/cpan/Encode/META.yml b/gnu/usr.bin/perl/cpan/Encode/META.yml
index 2a5c1ab762b..d73458f7bd1 100644
--- a/gnu/usr.bin/perl/cpan/Encode/META.yml
+++ b/gnu/usr.bin/perl/cpan/Encode/META.yml
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Encode
-version: 2.39
+version: 2.44
abstract: ~
author: []
license: unknown
@@ -14,7 +14,7 @@ no_index:
directory:
- t
- inc
-generated_by: ExtUtils::MakeMaker version 6.55_02
+generated_by: ExtUtils::MakeMaker version 6.57_05
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
diff --git a/gnu/usr.bin/perl/cpan/Encode/t/Aliases.t b/gnu/usr.bin/perl/cpan/Encode/t/Aliases.t
index fd088d5275b..d7a72d2761f 100755
--- a/gnu/usr.bin/perl/cpan/Encode/t/Aliases.t
+++ b/gnu/usr.bin/perl/cpan/Encode/t/Aliases.t
@@ -16,6 +16,7 @@ use strict;
use Encode;
use Encode::Alias;
my %a2c;
+my @override_tests;
my $ON_EBCDIC;
sub init_a2c{
@@ -108,6 +109,14 @@ BEGIN{
@ARGV and $ON_EBCDIC = $ARGV[0] eq 'EBCDIC';
$Encode::ON_EBCDIC = $ON_EBCDIC;
init_a2c();
+ @override_tests = qw(
+ myascii:cp1252
+ mygreek:cp1253
+ myhebrew:iso-8859-2
+ myarabic:cp1256
+ ueightsomething:utf-8-strict
+ unknown:
+ );
}
if ($ON_EBCDIC){
@@ -120,7 +129,7 @@ if ($ON_EBCDIC){
};
}
-use Test::More tests => (scalar keys %a2c) * 4;
+use Test::More tests => (scalar keys %a2c) * 3 + @override_tests;
print "# alias test; \$ON_EBCDIC == $ON_EBCDIC\n";
@@ -134,20 +143,29 @@ foreach my $a (keys %a2c){
# now we override some of the aliases and see if it works fine
define_alias(
- qr/ascii/i => 'WinLatin1',
- qr/cyrillic/i => 'WinCyrillic',
- qr/arabic/i => 'WinArabic',
- qr/greek/i => 'WinGreek',
- qr/hebrew/i => 'WinHebrew'
+ qr/ascii/i => '"WinLatin1"',
+ qr/cyrillic/i => '"WinCyrillic"',
+ qr/arabic/i => '"WinArabic"',
+ qr/greek/i => '"WinGreek"',
+ qr/hebrew/i => '"WinHebrew"'
);
+Encode::find_encoding("myhebrew"); # polute alias cache
+
+define_alias( sub {
+ my $enc = shift;
+ return "iso-8859-2" if $enc =~ /hebrew/i;
+ return "does-not-exist" if $enc =~ /arabic/i; # should then use other override alias
+ return "utf-8" if $enc =~ /eight/i;
+ return;
+});
+
print "# alias test with alias overrides\n";
-foreach my $a (keys %a2c){
- print "# $a => $a2c{$a}\n";
+for my $test (@override_tests) {
+ my($a, $c) = split /:/, $test;
my $e = Encode::find_encoding($a);
- is((defined($e) and $e->name), $a2c{$a}, "Override $a")
- or warn "alias was $a";
+ is((defined($e) and $e->name), $c, $a);
}
print "# alias undef test\n";
diff --git a/gnu/usr.bin/perl/cpan/Encode/t/guess.t b/gnu/usr.bin/perl/cpan/Encode/t/guess.t
index 37ddd5a0b12..81ab91b5624 100755
--- a/gnu/usr.bin/perl/cpan/Encode/t/guess.t
+++ b/gnu/usr.bin/perl/cpan/Encode/t/guess.t
@@ -17,7 +17,7 @@ use File::Spec;
use Encode qw(decode encode find_encoding _utf8_off);
#use Test::More qw(no_plan);
-use Test::More tests => 30;
+use Test::More tests => 32;
use_ok("Encode::Guess");
{
no warnings;
@@ -63,6 +63,16 @@ is (decode('Guess', encode('euc-jp', $utf8on)), $utf8on, "decode('Guess')");
eval{ encode('Guess', $utf8on) };
like($@, qr/not defined/io, "no encode()");
+{
+ my $warning;
+ local $SIG{__WARN__} = sub { $warning = shift };
+ my $euc_jp = my $euc_jp_clone = encode('euc-jp', $utf8on);
+ Encode::from_to($euc_jp, 'Guess', 'euc-jp');
+ is $euc_jp_clone, $euc_jp, "from_to(..., 'Guess')";
+ ok !$warning, "no warning";
+ diag $warning if $warning;
+}
+
my %CJKT =
(
'euc-cn' => File::Spec->catfile(dirname(__FILE__), 'gb2312.utf'),
diff --git a/gnu/usr.bin/perl/cpan/Encode/t/utf8ref.t b/gnu/usr.bin/perl/cpan/Encode/t/utf8ref.t
new file mode 100644
index 00000000000..3253e08639d
--- /dev/null
+++ b/gnu/usr.bin/perl/cpan/Encode/t/utf8ref.t
@@ -0,0 +1,20 @@
+#
+# $Id: utf8ref.t,v 1.1 2010/09/18 18:39:51 dankogai Exp $
+#
+
+use strict;
+use warnings;
+use Encode;
+use Test::More;
+plan tests => 4;
+#plan 'no_plan';
+
+# my $a = find_encoding('ASCII');
+my $u = find_encoding('UTF-8');
+my $r = [];
+no warnings 'uninitialized';
+is encode_utf8($r), ''.$r;
+is $u->encode($r), '';
+$r = {};
+is decode_utf8($r), ''.$r;
+is $u->decode($r), '';
diff --git a/gnu/usr.bin/perl/cpan/Encode/t/utf8strict.t b/gnu/usr.bin/perl/cpan/Encode/t/utf8strict.t
index 37e771340f4..3f362f49816 100755
--- a/gnu/usr.bin/perl/cpan/Encode/t/utf8strict.t
+++ b/gnu/usr.bin/perl/cpan/Encode/t/utf8strict.t
@@ -16,6 +16,7 @@ BEGIN {
exit 0;
}
# http://smontagu.damowmow.com/utf8test.html
+ # The numbers below, like 2.1.2 are test numbers on this web page
%ORD = (
0x00000080 => 0, # 2.1.2
0x00000800 => 0, # 2.1.3
@@ -44,7 +45,7 @@ BEGIN {
%SEQ = (
qq/dd 64 73 73/ => 0, # 2.3.1
qq/dd 67 41 41/ => 0, # 2.3.2
- qq/ee 42 73 73 73/ => 0, # 2.3.3
+ qq/ee 42 73 73 71/ => 0, # 2.3.3
qq/f4 90 80 80/ => 1, # 2.3.4 -- out of range so NG
# "3 Malformed sequences" are checked by perl.
# "4 Overlong sequences" are checked by perl.
@@ -53,7 +54,7 @@ BEGIN {
%SEQ = (
qq/ed 9f bf/ => 0, # 2.3.1
qq/ee 80 80/ => 0, # 2.3.2
- qq/f4 8f bf bf/ => 0, # 2.3.3
+ qq/f4 8f bf bd/ => 0, # 2.3.3
qq/f4 90 80 80/ => 1, # 2.3.4 -- out of range so NG
# "3 Malformed sequences" are checked by perl.
# "4 Overlong sequences" are checked by perl.