File: encoding.t

package info (click to toggle)
libio-all-perl 0.87-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 712 kB
  • sloc: perl: 2,017; makefile: 5
file content (46 lines) | stat: -rw-r--r-- 965 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use strict; use warnings;
my $t; use lib ($t = -e 't' ? 't' : 'test');
use Test::More;
use IO_All_Test;

BEGIN {
    eval { require PerlIO::encoding };
    plan(skip_all => 'no PerlIO::encoding') if $@;
    plan(($] < 5.008003)
          ? (skip_all => 'Broken on older perls')
          : (tests => 4)
    );
}

package Normal;

use IO::All;

package UTF8;

use IO::All -utf8;

package Big5;

use IO::All -encoding => 'big5';

package main;

isnt Normal::io("$t/text.big5")->all,
     Normal::io("$t/text.utf8")->all,
     'big5 and utf8 tests are different';

isnt Normal::io("$t/text.big5")->all,
     Big5::io("$t/text.big5")->all,
     'Read big5 with different io-s does not match';

is UTF8::io("$t/text.utf8")->all,
   Big5::io("$t/text.big5")->all,
   'Big5 text matches utf8 text after read';

is Normal::io("$t/text.utf8")->utf8->all,
   Normal::io("$t/text.big5")->encoding('big5')->all,
   'Big5 text matches utf8 text after read';


del_output_dir();