|
Lines 215-221
subtest 'options() tests' => sub {
Link Here
|
| 215 |
|
215 |
|
| 216 |
subtest "'TrimFields' filter tests" => sub { |
216 |
subtest "'TrimFields' filter tests" => sub { |
| 217 |
|
217 |
|
| 218 |
plan tests => 2; |
218 |
plan tests => 4; |
| 219 |
|
219 |
|
| 220 |
# Test default values with a MARC::Record record |
220 |
# Test default values with a MARC::Record record |
| 221 |
my $record = MARC::Record->new(); |
221 |
my $record = MARC::Record->new(); |
|
Lines 225-230
subtest "'TrimFields' filter tests" => sub {
Link Here
|
| 225 |
[ '150', ' ', ' ', a => 'Test' ], |
225 |
[ '150', ' ', ' ', a => 'Test' ], |
| 226 |
[ '520', ' ', ' ', a => "This is\na test!\t" ], |
226 |
[ '520', ' ', ' ', a => "This is\na test!\t" ], |
| 227 |
[ '521', ' ', ' ', a => "This is a\t test!\t" ], |
227 |
[ '521', ' ', ' ', a => "This is a\t test!\t" ], |
|
|
228 |
[ '522', ' ', ' ', a => "This is a test!", b => " " ], |
| 229 |
[ '523', ' ', ' ', a => " " ], |
| 228 |
); |
230 |
); |
| 229 |
|
231 |
|
| 230 |
my $p = Koha::RecordProcessor->new( { filters => ['TrimFields'] } ); |
232 |
my $p = Koha::RecordProcessor->new( { filters => ['TrimFields'] } ); |
|
Lines 235-238
subtest "'TrimFields' filter tests" => sub {
Link Here
|
| 235 |
|
237 |
|
| 236 |
my $get521a = $record->subfield( '521', 'a' ); |
238 |
my $get521a = $record->subfield( '521', 'a' ); |
| 237 |
is( $get521a, "This is a\t test!", "Trailing tabs are stripped while inner tabs are kept" ); |
239 |
is( $get521a, "This is a\t test!", "Trailing tabs are stripped while inner tabs are kept" ); |
|
|
240 |
|
| 241 |
my $get522b = $record->subfield( '522', 'b' ); |
| 242 |
isnt( $get522b, "", "Subfield containing spaces only removed from the field" ); |
| 243 |
|
| 244 |
my $get523 = $record->field('523'); |
| 245 |
is( $get523, undef, "Field with only a subfield containing spaces removed from the record" ); |
| 238 |
}; |
246 |
}; |
| 239 |
- |
|
|