3 |
use strict; |
use strict; |
4 |
use blib; |
use blib; |
5 |
|
|
6 |
use Test::More tests => 325; |
use Test::More tests => 330; |
7 |
|
|
8 |
BEGIN { |
BEGIN { |
9 |
use_ok( 'WebPAC::Test' ); |
use_ok( 'WebPAC::Test' ); |
129 |
} |
} |
130 |
|
|
131 |
sub test_marc_clone { |
sub test_marc_clone { |
132 |
my $rec = shift; |
my ( $rec, $expect ) = @_; |
133 |
|
|
134 |
ok( _clean_ds(), '_clean_ds' ); |
ok( _clean_ds(), '_clean_ds' ); |
135 |
ok( _set_ds( $rec ), '_set_ds' ); |
ok( _set_ds( $rec ), '_set_ds' ); |
136 |
|
|
137 |
ok( marc_clone, 'marc_clone' ); |
ok( ! marc_clone, 'marc_clone' ); |
138 |
|
|
139 |
ok(my $marc = WebPAC::Normalize::MARC::_get_marc_fields(), "_get_marc_fields"); |
ok(my $marc = WebPAC::Normalize::MARC::_get_marc_fields(), "_get_marc_fields"); |
140 |
diag "rec = ",dump( $rec ); |
# diag "rec = ",dump( $rec ); |
141 |
diag "marc = ",dump( $marc ); |
# diag "marc = ",dump( $marc ); |
142 |
|
# diag "expect = ",dump( $marc ); |
143 |
|
|
144 |
is_deeply( $rec, $marc, 'same' ); |
is_deeply( $marc, $expect, 'marc_clone same' ); |
145 |
|
|
146 |
} |
} |
147 |
|
|
148 |
test_marc_clone( { |
test_marc_clone( { |
149 |
'900' => [{ 'a' => '900a', 'b' => '900b', subfields => [ qw/a 0 b 0/ ] }], |
'900' => [{ 'a' => '900a', 'b' => '900b', subfields => [ qw/a 0 b 0/ ] }], |
150 |
'901' => [{ 'c' => '901c', subfields => [ qw/c 0/ ] }], |
'901' => [{ 'c' => '901c', subfields => [ qw/c 0/ ] }], |
151 |
} ); |
}, [ |
152 |
|
[900, " ", " ", "a", "900a", "b", "900b"], |
153 |
|
[901, " ", " ", "c", "901c"], |
154 |
|
] ); |
155 |
|
|