2 |
|
|
3 |
use strict; |
use strict; |
4 |
|
|
5 |
use Test::More tests => 56; |
use Test::More tests => 64; |
6 |
use Test::Exception; |
use Test::Exception; |
7 |
use Cwd qw/abs_path/; |
use Cwd qw/abs_path/; |
8 |
use blib; |
use blib; |
291 |
|
|
292 |
ok($ds = get_ds(), "get_ds"); |
ok($ds = get_ds(), "get_ds"); |
293 |
diag "ds = ", Dumper($ds) if ($debug); |
diag "ds = ", Dumper($ds) if ($debug); |
294 |
|
|
295 |
|
my $rec = { |
296 |
|
'200' => [{ |
297 |
|
'a' => '200a', |
298 |
|
'b' => '200b', |
299 |
|
}], |
300 |
|
}; |
301 |
|
my $rules = qq{ search('mixed', rec('200') ) }; |
302 |
|
|
303 |
|
clean_ds(); |
304 |
|
set_rec( $rec ); |
305 |
|
test_s( $rules ); |
306 |
|
ok($ds = get_ds(), "get_ds"); |
307 |
|
is_deeply( $ds, { |
308 |
|
'mixed' => { |
309 |
|
'search' => [ '200a', '200b' ], |
310 |
|
'tag' => 'mixed' |
311 |
|
} |
312 |
|
}, 'correct get_ds'); |
313 |
|
|
314 |
|
ok(my $ds2 = WebPAC::Normalize::Set::data_structure( |
315 |
|
row => $rec, |
316 |
|
rules => $rules, |
317 |
|
), 'data_structure'); |
318 |
|
is_deeply( $ds, $ds2, 'data_structure(s) same'); |
319 |
|
|
320 |
|
# wird and non-valid structure which is supported anyway |
321 |
|
clean_ds(); |
322 |
|
set_rec({ |
323 |
|
'200' => [{ |
324 |
|
'a' => '200a', |
325 |
|
}, |
326 |
|
'200-solo' |
327 |
|
] |
328 |
|
}); |
329 |
|
test_s(qq{ search('mixed', rec('200') ) }); |
330 |
|
ok($ds = get_ds(), "get_ds"); |
331 |
|
is_deeply( $ds, { |
332 |
|
'mixed' => { |
333 |
|
'search' => [ '200a', '200-solo' ], |
334 |
|
'tag' => 'mixed' |
335 |
|
} |
336 |
|
}, 'correct get_ds'); |
337 |
|
|
338 |
} |
} |
339 |
|
|