Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 5; |
22 |
use Test::More tests => 6; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
25 |
use MARC::Record; |
25 |
use MARC::Record; |
Lines 143-145
subtest "new() tests" => sub {
Link Here
|
143 |
is( $metadata_record, undef, 'record object mandatory') |
143 |
is( $metadata_record, undef, 'record object mandatory') |
144 |
}; |
144 |
}; |
145 |
|
145 |
|
146 |
- |
146 |
subtest "stripWhitespaceChars() tests" => sub { |
|
|
147 |
plan tests => 2; |
148 |
|
149 |
# Test default values with a MARC::Record record |
150 |
my $record = MARC::Record->new(); |
151 |
|
152 |
$record->add_fields( |
153 |
[ '001', '1234' ], |
154 |
[ '150', ' ', ' ', a => 'Test' ], |
155 |
[ '520', ' ', ' ', a => "This is\na test!\t" ], |
156 |
[ '521', ' ', ' ', a => "This is a\t test!\t" ], |
157 |
); |
158 |
|
159 |
$record = Koha::MetadataRecord::stripWhitespaceChars( $record ); |
160 |
|
161 |
my $get520a = $record->subfield('520','a'); |
162 |
is( $get520a, "This is a test!", "Whitespace characters are appropriately stripped or replaced with spaces" ); |
163 |
|
164 |
my $get521a = $record->subfield('521','a'); |
165 |
is( $get521a, "This is a\t test!", "Trailing tabs are stripped while inner tabs are kept" ); |
166 |
}; |