diff --git a/metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java b/metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java index 92cf0e2f..df98f347 100644 --- a/metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java +++ b/metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java @@ -1486,6 +1486,47 @@ public void replaceAllWithWildcardAfterCopyFieldWithVarInSourceAndTarget() { ); } + @Test + @MetafixToDo("See https://github.com/metafacture/metafacture-fix/pull/170") + public void multipleReplaceAllWithWildcardAfterCopyFieldWithVarInSourceAndTarget() { + MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList( + "set_array('RSWK[]')", + "do list(path: '650??', 'var': '$i')", + " copy_field('$i.a', 'RSWK[].$append.subjectTopicName')", + " copy_field('$i.v', 'RSWK[].$last.subjectGenre')", + "end", + "replace_all('RSWK[].*.subjectGenre', '[.]$', '')", + "replace_all('RSWK[].*.subjectGenre', '[.]$', '')", + "retain('RSWK[]')" + ), + i -> { + i.startRecord("1"); + i.startEntity("650 "); + i.literal("a", "Nonprofit organizations"); + i.literal("x", "Management."); + i.endEntity(); + i.startEntity("650 "); + i.literal("a", "Nonprofit organizations"); + i.literal("x", "Management"); + i.literal("v", "Case studies."); + i.endEntity(); + i.endRecord(); + }, + (o, f) -> { + o.get().startRecord("1"); + o.get().startEntity("RSWK[]"); + o.get().startEntity("1"); + o.get().literal("subjectTopicName", "Nonprofit organizations"); + o.get().endEntity(); + o.get().startEntity("2"); + o.get().literal("subjectTopicName", "Nonprofit organizations"); + o.get().literal("subjectGenre", "Case studies"); + f.apply(2).endEntity(); + o.get().endRecord(); + } + ); + } + @Test @MetafixToDo("See https://github.com/metafacture/metafacture-fix/pull/170") public void copyFieldToSubfieldOfArrayOfObjectsWithIndexImplicitAppend() {