Bugzilla – Attachment 130759 Details for
Bug 23873
Allow marc modification templates to use capturing groups in substitutions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23873: Unit tests
Bug-23873-Unit-tests.patch (text/plain), 3.27 KB, created by
Nick Clemens (kidclamp)
on 2022-02-17 15:25:30 UTC
(
hide
)
Description:
Bug 23873: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-02-17 15:25:30 UTC
Size:
3.27 KB
patch
obsolete
>From bd39b5d9897af9f82e4d2c2e610d4a0f0df78dbf Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 13 Dec 2021 10:20:54 +0000 >Subject: [PATCH] Bug 23873: Unit tests > >This patch adds a unit test for capture groups support in >Koha::SimpleMARC. > >Test plan >1) Run the test prior to applying the capture groups fix, note it fails. >2) Apply teh capture groups fix patch >3) Run the test again, it should now pass > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > t/SimpleMARC.t | 47 +++++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 45 insertions(+), 2 deletions(-) > >diff --git a/t/SimpleMARC.t b/t/SimpleMARC.t >index 91b77432e5..04e9a7eabb 100755 >--- a/t/SimpleMARC.t >+++ b/t/SimpleMARC.t >@@ -326,7 +326,7 @@ subtest 'update_field' => sub { > subtest 'copy_field' => sub { > plan tests => 2; > subtest 'copy subfield' => sub { >- plan tests => 20; >+ plan tests => 21; > my $record = new_record; > $record->append_fields( > MARC::Field->new( >@@ -672,6 +672,27 @@ subtest 'copy_field' => sub { > 'Update a subfield: add a string at the end' > ); > >+ $record = new_record; >+ copy_field( >+ { >+ record => $record, >+ from_field => 245, >+ from_subfield => 'a', >+ to_field => 245, >+ to_subfield => 'a', >+ regex => { search => '(art)', replace => 'sm$1 $1' } >+ } >+ ); >+ is_deeply( >+ [ >+ read_field( >+ { record => $record, field => '245', subfield => 'a' } >+ ) >+ ], >+ ['The art of computer programming', 'The smart art of computer programming'], >+ 'Update a subfield: use capture groups' >+ ); >+ > $record = new_record; > copy_field( > { >@@ -900,7 +921,7 @@ subtest 'copy_field' => sub { > subtest 'copy_and_replace_field' => sub { > plan tests => 2; > subtest 'copy and replace subfield' => sub { >- plan tests => 19; >+ plan tests => 20; > my $record = new_record; > $record->append_fields( > MARC::Field->new( >@@ -1246,6 +1267,28 @@ subtest 'copy_and_replace_field' => sub { > 'Copy and replace - Update a subfield: add a string at the end' > ); > >+ $record = new_record; >+ copy_and_replace_field( >+ { >+ record => $record, >+ from_field => 245, >+ from_subfield => 'a', >+ to_field => 245, >+ to_subfield => 'a', >+ regex => { search => '(art)', replace => 'sm$1 $1' } >+ } >+ ); >+ # This is the same as update the subfield >+ is_deeply( >+ [ >+ read_field( >+ { record => $record, field => '245', subfield => 'a' } >+ ) >+ ], >+ ['The smart art of computer programming'], >+ 'Copy and replace - Update a subfield: use capture groups' >+ ); >+ > $record = new_record; > copy_and_replace_field( > { >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23873
:
128430
|
128431
|
128432
|
128433
|
128980
|
128981
| 130759 |
130760