View | Details | Raw Unified | Return to bug 11540
Collapse All | Expand All

(-)a/t/Charset.t (-5 / +40 lines)
Lines 1-9 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
use strict;
3
# This file is part of Koha.
4
use warnings;
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Test::More tests => 10;
21
use MARC::Record;
5
22
6
use Test::More tests => 7;
7
BEGIN {
23
BEGIN {
8
    use_ok('C4::Charset');
24
    use_ok('C4::Charset');
9
}
25
}
Lines 19-22 ok(!utf8::is_utf8($octets), "verify that IsStringUTF8ish does not magically turn Link Here
19
$octets = "a\xc2" . "c";
35
$octets = "a\xc2" . "c";
20
ok(!IsStringUTF8ish($octets), "verify octets are not valid UTF-8");
36
ok(!IsStringUTF8ish($octets), "verify octets are not valid UTF-8");
21
37
22
ok(!SetUTF8Flag(), 'Testing SetUTF8Flag' );
38
ok( !SetUTF8Flag(), 'SetUTF8Flag returns undef if no record passed' );
39
40
my $record = MARC::Record->new();
41
ok( !SetUTF8Flag($record), 'SetUTF8Flag returns undef if the record has no subfields' );
42
# Add some fields/subfields
43
$record->append_fields(
44
    MARC::Field->new('100', ' ', ' ', a => 'Julio Cortazar'),
45
    MARC::Field->new('245', ' ', ' ', a => 'Rayuela'),
46
);
47
# Verify our data serves its purpose
48
ok( !utf8::is_utf8($record->subfield('100','a')) &&
49
    !utf8::is_utf8($record->subfield('245','a')),
50
    'Verify that the subfields are NOT set the UTF-8 flag yet' );
51
52
SetUTF8Flag($record);
53
54
ok( utf8::is_utf8($record->subfield('100','a')) &&
55
    utf8::is_utf8($record->subfield('245','a')),
56
    'SetUTF8Flag sets the UTF-8 flag to all subfields' );
57
58
1;
23
- 

Return to bug 11540