1 |
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
2 |
|
|
3 |
use strict; |
use strict; |
4 |
use Test::More tests => 4; |
use Test::More tests => 5; |
5 |
use Test::Exception; |
use Test::Exception; |
6 |
use blib; |
use blib; |
7 |
|
|
19 |
|
|
20 |
ok(my $v = new WebPAC::Validate( |
ok(my $v = new WebPAC::Validate( |
21 |
path => "$abs_path/data/validate_test", |
path => "$abs_path/data/validate_test", |
22 |
delimiters => [ ' : ', ' ; ', ' / ', ' \. ' ], |
delimiters => [ ' : ', ' ; ', ' / ', ' \. ', ' = ' ], |
23 |
debug => $debug, |
debug => $debug, |
24 |
), "new"); |
), "new"); |
25 |
|
|
41 |
} |
} |
42 |
|
|
43 |
test_v({ |
test_v({ |
44 |
'900' => [ { 'a' => 'a : aa = aaa : a ; a', 'b' => 'b ; b ; b ; b ; a : / z . z . ' }, { 'c' => 'a : b ; c / d' } ] |
'900' => [ |
45 |
|
{ 'a' => 'a : aa = aaa : a ; a', 'b' => 'b ; b ; b ; b ; a : / z . z . ' }, |
46 |
|
{ 'a' => 'a : a : a', 'c' => [ 'a : b ; c', 'a : b ; c / d' ] }, |
47 |
|
{ 'a' => 'a : b / c' }, |
48 |
|
{ 'a' => 'a : b / c' }, |
49 |
|
], |
50 |
|
'901' => [ |
51 |
|
{ 'a' => 'a : b / c', 'b' => 'foo' }, |
52 |
|
{ 'a' => 'a : b / c', 'b' => 'foo' }, |
53 |
|
], |
54 |
}); |
}); |
55 |
|
|
56 |
diag dump($v->{_delimiters_templates}); |
diag dump($v->{_delimiters_templates}); |
57 |
|
|
58 |
is_deeply( $v->{_delimiters_templates}, { |
is_deeply( $v->{_delimiters_templates}, { |
59 |
900 => { |
900 => { |
60 |
"^a : : ; ^b ; ; ; ; : . . " => 1, |
"^a : / " => 2, |
61 |
"^a : : ; ^b ; ; ; ; : . . ^c : ; / " => 1, |
"^a : : ^c : ; ^c : ; / " => 1, |
62 |
|
"^a : = : ; ^b ; ; ; ; : . . " => 1, |
63 |
}, |
}, |
64 |
|
901 => { "^a : / ^b" => 2 }, |
65 |
}, 'just subfields and delimiters'); |
}, 'just subfields and delimiters'); |
66 |
|
|
67 |
|
ok(my $dt = $v->delimiters_templates, 'delimiters_template'); |
68 |
|
diag $dt; |