Skip to content

Commit 87e30a7

Browse files
committed
Don't append scopeVariable name, set base path on new values (#278)
Tweak test: add blank inserted by `paste` as default `join_char`
1 parent e7ff7fd commit 87e30a7

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

metafix/src/main/java/org/metafacture/metafix/FixBind.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void execute(final Metafix metafix, final Record record, final List<Strin
3636

3737
// with var -> keep full record in scope, add the var:
3838
if (scopeVariable != null) {
39-
record.put(scopeVariable, value);
39+
record.put(scopeVariable, value, false);
4040
recordTransformer.transform(record);
4141
record.remove(scopeVariable);
4242
}

metafix/src/main/java/org/metafacture/metafix/FixPath.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ else if (isReference(field)) {
276276
}
277277
else {
278278
if (!hash.containsField(field)) {
279-
hash.put(field, Value.newHash());
279+
hash.put(field, Value.newHash().withPathSet(newValue.getPath()));
280280
}
281281
insertInto(hash.get(field), mode, newValue, field, tail(path));
282282
}

metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2771,7 +2771,6 @@ public void addFieldWithoutReplaceAllArray() {
27712771
}
27722772

27732773
@Test
2774-
@MetafixToDo("See https://github.com/metafacture/metafacture-fix/issues/278")
27752774
public void addFieldWithReplaceAllArray() {
27762775
addFieldWithReplaceAllArray(true);
27772776
}
@@ -2885,7 +2884,6 @@ public void copyFieldWithoutReplaceAllArray() {
28852884
}
28862885

28872886
@Test
2888-
@MetafixToDo("See https://github.com/metafacture/metafacture-fix/issues/278")
28892887
public void copyFieldWithReplaceAllArray() {
28902888
copyFieldWithReplaceAllArray(true);
28912889
}
@@ -2943,7 +2941,6 @@ public void pasteWithoutReplaceAll() {
29432941
}
29442942

29452943
@Test
2946-
@MetafixToDo("See https://github.com/metafacture/metafacture-fix/issues/278")
29472944
public void pasteWithReplaceAll() {
29482945
pasteWithReplaceAll(true);
29492946
}
@@ -2958,8 +2955,8 @@ private void pasteWithReplaceAll(final boolean replaceAll) {
29582955
" set_array('$i.altLabel[]')",
29592956
" paste('$i.altLabel[].$append', '$i.label', '~!')",
29602957
"end",
2961-
replaceAll ? "replace_all('contribution[].*.agent.altLabel[].*', '!', '')" : "",
2962-
replaceAll ? "replace_all('subject[].*.altLabel[].*', '!', '')" : ""
2958+
replaceAll ? "replace_all('contribution[].*.agent.altLabel[].*', ' !', '')" : "",
2959+
replaceAll ? "replace_all('subject[].*.altLabel[].*', ' !', '')" : ""
29632960
),
29642961
i -> {
29652962
i.startRecord("1");

0 commit comments

Comments
 (0)