yq/acceptance_tests/bad_args.sh

41 lines
1.2 KiB
Bash
Raw Normal View History

2021-10-30 02:04:05 +00:00
#!/bin/bash
testWriteInPlacePipeIn() {
result=$(./yq e -i -n '.a' 2>&1)
assertEquals 1 $?
2023-09-18 23:52:36 +00:00
assertEquals "Error: write in place flag only applicable when giving an expression and at least one file" "$result"
2021-10-30 02:04:05 +00:00
}
testWriteInPlacePipeInEvalall() {
result=$(./yq ea -i -n '.a' 2>&1)
assertEquals 1 $?
2023-09-18 23:52:36 +00:00
assertEquals "Error: write in place flag only applicable when giving an expression and at least one file" "$result"
2021-10-30 02:04:05 +00:00
}
testWriteInPlaceWithSplit() {
result=$(./yq e -s "cat" -i '.a = "thing"' test.yml 2>&1)
assertEquals 1 $?
2023-09-18 23:52:36 +00:00
assertEquals "Error: write in place cannot be used with split file" "$result"
2021-10-30 02:04:05 +00:00
}
testWriteInPlaceWithSplitEvalAll() {
result=$(./yq ea -s "cat" -i '.a = "thing"' test.yml 2>&1)
assertEquals 1 $?
2023-09-18 23:52:36 +00:00
assertEquals "Error: write in place cannot be used with split file" "$result"
2021-10-30 02:04:05 +00:00
}
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