Lines 155-161
subtest 'blank' => sub {
Link Here
|
155 |
}; |
155 |
}; |
156 |
|
156 |
|
157 |
subtest 'regex' => sub { |
157 |
subtest 'regex' => sub { |
158 |
plan tests => 6; |
158 |
plan tests => 12; |
159 |
|
159 |
|
160 |
$items->batch_update( |
160 |
$items->batch_update( |
161 |
{ |
161 |
{ |
Lines 203-208
subtest 'regex' => sub {
Link Here
|
203 |
['awesome yyy 1|new yyy 2'], |
203 |
['awesome yyy 1|new yyy 2'], |
204 |
'y is not repeatable' |
204 |
'y is not repeatable' |
205 |
); |
205 |
); |
|
|
206 |
|
207 |
$re = { |
208 |
search => '(awesome)', |
209 |
replace => '$1ness', |
210 |
modifiers => '', |
211 |
}; |
212 |
$items->batch_update( |
213 |
{ |
214 |
regex_mod => |
215 |
{ itemnotes => $re, copynumber => $re, x => $re, y => $re } |
216 |
} |
217 |
)->reset; |
218 |
$item = $item->get_from_storage; |
219 |
is( $item->itemnotes, 'awesomeness notes 1|new notes 2' ); |
220 |
is_deeply( |
221 |
[ $item->as_marc_field->subfield('z') ], |
222 |
[ 'awesomeness notes 1', 'new notes 2' ], |
223 |
'z is repeatable' |
224 |
); |
225 |
|
226 |
is( $item->copynumber, 'awesomeness cn 1|new cn 2' ); |
227 |
is_deeply( [ $item->as_marc_field->subfield('t') ], |
228 |
['awesomeness cn 1|new cn 2'], 't is not repeatable' ); |
229 |
|
230 |
is_deeply( |
231 |
[ $item->as_marc_field->subfield('x') ], |
232 |
[ 'awesomeness xxx 1', 'new xxx 2' ], |
233 |
'i is repeatable' |
234 |
); |
235 |
|
236 |
is_deeply( |
237 |
[ $item->as_marc_field->subfield('y') ], |
238 |
['awesomeness yyy 1|new yyy 2'], |
239 |
'y is not repeatable' |
240 |
); |
206 |
}; |
241 |
}; |
207 |
|
242 |
|
208 |
subtest 'encoding' => sub { |
243 |
subtest 'encoding' => sub { |
209 |
- |
|
|