File: 030_native.t

package info (click to toggle)
libunicode-utf8-perl 0.62-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 492 kB
  • sloc: perl: 2,365; sh: 6; makefile: 3
file content (22 lines) | stat: -rwxr-xr-x 442 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
#!perl

use strict;
use warnings;

use Test::More  tests => 3;
use Test::Fatal qw[lives_ok];

BEGIN {
    use_ok('Unicode::UTF8', qw[ encode_utf8 ]);
}

{   my $string = "bl\xE5b\xE4r \xE4r g\xF6tt!";
    my $octets = "blåbär är gött!";
    my $got    = '';
    lives_ok { 
        use warnings FATAL => 'utf8';
        $got = encode_utf8($string); 
    } 'encode_utf8() native string';
    is($got, $octets, 'encoded native string');
}