Lines 17-27
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 16; |
20 |
use Test::More tests => 17; |
21 |
use Encode qw( is_utf8 ); |
21 |
use Encode qw( is_utf8 ); |
22 |
|
22 |
|
23 |
use MARC::Record; |
23 |
use MARC::Record; |
24 |
|
24 |
|
|
|
25 |
use t::lib::Mocks; |
26 |
|
25 |
use utf8; |
27 |
use utf8; |
26 |
use open ':std', ':encoding(utf8)'; |
28 |
use open ':std', ':encoding(utf8)'; |
27 |
|
29 |
|
Lines 71-74
ok( Encode::is_utf8($record->subfield('100','a')) &&
Link Here
|
71 |
|
73 |
|
72 |
is( nsb_clean("Le Moyen Âge"), "Le Moyen Âge", "nsb_clean removes and " ); |
74 |
is( nsb_clean("Le Moyen Âge"), "Le Moyen Âge", "nsb_clean removes and " ); |
73 |
|
75 |
|
|
|
76 |
subtest 'SetMarcUnicodeFlag' => sub { |
77 |
plan tests => 2; |
78 |
# TODO This should be done in MARC::Record |
79 |
my $leader = '012345678X0 '; |
80 |
my $expected_marc21_leader = '012345678a0 '; # position 9 of leader must be 'a' |
81 |
my $expected_unimarc_leader = '012345678X0 '; # position 9 of leader must not be changed |
82 |
# Note that position 9 of leader should be blank for UNIMARC, but as it is not related to encoding |
83 |
# we do not want to change it |
84 |
|
85 |
t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' ); |
86 |
my $marc21_record = MARC::Record->new; |
87 |
$marc21_record->leader($leader); |
88 |
SetMarcUnicodeFlag( $marc21_record, C4::Context->preference('marcflavour') ); |
89 |
is( $marc21_record->leader, $expected_marc21_leader, 'Leader 9 for MARC21 mush be "a"' ); |
90 |
|
91 |
t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' ); |
92 |
t::lib::Mocks::mock_preference( 'UNIMARCField100Language', 'fre' ); |
93 |
my $unimarc_record = MARC::Record->new; |
94 |
$unimarc_record->leader($leader); |
95 |
SetMarcUnicodeFlag( $unimarc_record, C4::Context->preference('marcflavour') ); |
96 |
is( $unimarc_record->leader, $expected_unimarc_leader, 'Leader 9 for UNIMARC must be blank' ); |
97 |
}; |
98 |
|
74 |
1; |
99 |
1; |
75 |
- |
|
|