mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 13:48:06 +00:00
41 lines
1.2 KiB
Bash
41 lines
1.2 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
testWriteInPlacePipeIn() {
|
||
|
result=$(./yq e -i -n '.a' 2>&1)
|
||
|
assertEquals 1 $?
|
||
|
assertEquals "Error: write inplace flag only applicable when giving an expression and at least one file" "$result"
|
||
|
}
|
||
|
|
||
|
testWriteInPlacePipeInEvalall() {
|
||
|
result=$(./yq ea -i -n '.a' 2>&1)
|
||
|
assertEquals 1 $?
|
||
|
assertEquals "Error: write inplace flag only applicable when giving an expression and at least one file" "$result"
|
||
|
}
|
||
|
|
||
|
testWriteInPlaceWithSplit() {
|
||
|
result=$(./yq e -s "cat" -i '.a = "thing"' test.yml 2>&1)
|
||
|
assertEquals 1 $?
|
||
|
assertEquals "Error: write inplace cannot be used with split file" "$result"
|
||
|
}
|
||
|
|
||
|
testWriteInPlaceWithSplitEvalAll() {
|
||
|
result=$(./yq ea -s "cat" -i '.a = "thing"' test.yml 2>&1)
|
||
|
assertEquals 1 $?
|
||
|
assertEquals "Error: write inplace cannot be used with split file" "$result"
|
||
|
}
|
||
|
|
||
|
testNullWithFiles() {
|
||
|
result=$(./yq e -n '.a = "thing"' test.yml 2>&1)
|
||
|
assertEquals 1 $?
|
||
|
assertEquals "Error: cannot pass files in when using null-input flag" "$result"
|
||
|
}
|
||
|
|
||
|
testNullWithFilesEvalAll() {
|
||
|
result=$(./yq ea -n '.a = "thing"' test.yml 2>&1)
|
||
|
assertEquals 1 $?
|
||
|
assertEquals "Error: cannot pass files in when using null-input flag" "$result"
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
source ./scripts/shunit2
|