File: space.t

package info (click to toggle)
libmarc-charset-perl 1.35-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,476 kB
  • sloc: xml: 99,038; perl: 774; makefile: 9
file content (21 lines) | stat: -rw-r--r-- 599 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use Test::More tests => 4;
use strict;
use warnings;

use MARC::Charset 'marc8_to_utf8';
use MARC::Charset::Constants ':all';

is('foo bar', marc8_to_utf8('foo bar'), 'one space');
is('foo  bar', marc8_to_utf8('foo  bar'), 'two spaces');
is("a\r \x{0A}b \x{0D}c\n", marc8_to_utf8("a\r \x{0A}b \x{0D}c\n"), 'spaces with newlines and carriage returns');

my $test = 
    'a   ' . 
    ESCAPE . SINGLE_G0_A . BASIC_GREEK . 
    chr(0x49) .
    ESCAPE . SINGLE_G0_A . BASIC_LATIN . 
    '   b';

my $expected = 'a   ' . chr(0x0396) . '   b';
is(marc8_to_utf8($test), $expected, 'spacing with escape');