Adding acceptance test for #1257, fixed panic

This commit is contained in:
Mike Farah 2022-06-25 12:14:11 +10:00
parent 9b47a29864
commit 06d2aaad80
3 changed files with 27 additions and 0 deletions

View File

@ -331,4 +331,26 @@ EOM
assertEquals "$expected" "$X"
}
testBasicMultiplyAssignMultiDoc() {
cat >test.yml <<EOL
a: 1
---
b: 2
EOL
read -r -d '' expected << EOM
a: 1
c: 3
---
b: 2
c: 3
EOM
X=$(./yq '. *= {"c":3}' test.yml)
assertEquals "$expected" "$X"
}
source ./scripts/shunit2

View File

@ -22,6 +22,8 @@ func assignUpdateOperator(d *dataTreeNavigator, context Context, expressionNode
}
prefs := assignPreferences{}
// they way *= (multipleAssign) is handled, we set the multiplePrefs
// on the node, not assignPrefs. Long story.
if p, ok := expressionNode.Operation.Preferences.(assignPreferences); ok {
prefs = p
}

View File

@ -1,3 +1,6 @@
4.25.4:
- Fixed panic when using multiply assign on multiple documents #1256 Thanks @care0717
4.25.3:
- xml decoder now maintains namespaces by default. Use new flags to disable if required. Thanks @rndmit
- Length and other similar operators no longer return comments (#1231)