Added expression argument to forcibly set expression if required

This commit is contained in:
Mike Farah
2022-02-07 09:27:52 +11:00
parent 703418d0c4
commit 2891c6948d
6 changed files with 39 additions and 30 deletions
+13
View File
@@ -2,6 +2,7 @@
setUp() {
rm test*.yml || true
rm .xyz -f
}
testBasicEvalRoundTrip() {
@@ -16,6 +17,18 @@ testBasicPipeWithDot() {
assertEquals "a: 123" "$X"
}
testBasicExpressionMatchesFileName() {
./yq -n ".xyz = 123" > test.yml
touch .xyz
X=$(./yq --expression '.xyz' test.yml)
assertEquals "123" "$X"
X=$(./yq ea --expression '.xyz' test.yml)
assertEquals "123" "$X"
}
testBasicGitHubAction() {
./yq -n ".a = 123" > test.yml
X=$(cat /dev/null | ./yq test.yml)