yq/acceptance_tests/load-file.sh

27 lines
743 B
Bash
Raw Permalink Normal View History

2021-11-16 04:29:16 +00:00
#!/bin/bash
2021-11-16 05:08:37 +00:00
testLoadFileNotExist() {
result=$(./yq e -n 'load("cat.yml")' 2>&1)
assertEquals 1 $?
assertEquals "Error: Failed to load cat.yml: open cat.yml: no such file or directory" "$result"
2021-11-16 04:29:16 +00:00
}
2021-11-16 05:08:37 +00:00
testLoadFileExpNotExist() {
result=$(./yq e -n 'load(.a)' 2>&1)
assertEquals 1 $?
assertEquals "Error: filename expression returned nil" "$result"
2021-11-16 04:29:16 +00:00
}
testStrLoadFileNotExist() {
2021-11-16 05:08:37 +00:00
result=$(./yq e -n 'strload("cat.yml")' 2>&1)
assertEquals 1 $?
assertEquals "Error: Failed to load cat.yml: open cat.yml: no such file or directory" "$result"
}
testStrLoadFileExpNotExist() {
result=$(./yq e -n 'strload(.a)' 2>&1)
assertEquals 1 $?
assertEquals "Error: filename expression returned nil" "$result"
2021-11-16 05:08:37 +00:00
}
source ./scripts/shunit2