sfeed_update tests: only allow regular files for config files now - sfeed_tests - sfeed tests and RSS and Atom files
(HTM) git clone git://git.codemadness.org/sfeed_tests
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 69b79f5e6b68b0f85ad61909271259aeaaf0e1c3
(DIR) parent 5129274a38fd0b94af2d550dfa452e3d2660dc74
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 29 Dec 2023 14:00:11 +0100
sfeed_update tests: only allow regular files for config files now
Diffstat:
M input/sfeed_update/test.sh | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/input/sfeed_update/test.sh b/input/sfeed_update/test.sh
@@ -179,12 +179,20 @@ feeds() {
test_config_invocation() {
init_test
- "$SFEED_UPDATE" /dev/null >/dev/null 2> "$log_stderr" # should say feeds function is not defined.
+ rcempty="$(mktemp /tmp/sfeed_emptyrc_XXXXXXXX)"
+
+ "$SFEED_UPDATE" "$rcempty" >/dev/null 2> "$log_stderr" # should say feeds function is not defined.
expect "1" "$?" "exit statuscode"
msg='does not contain a "feeds" function'
fgrep -q "$msg" < "$log_stderr"
expect "0" "$?" "stderr must contain text $msg"
+ "$SFEED_UPDATE" /dev/null >/dev/null 2> "$log_stderr"
+ expect "1" "$?" "exit statuscode"
+ msg='Configuration file "/dev/null" cannot be read.'
+ fgrep -q "$msg" < "$log_stderr"
+ expect "0" "$?" "stderr must contain text $msg"
+
"$SFEED_UPDATE" nonexistant >/dev/null 2> "$log_stderr"
expect "1" "$?" "exit statuscode"
msg='Configuration file "nonexistant" cannot be read.'
@@ -227,8 +235,7 @@ test_config_invocation() {
expect "0" "$?" "stderr must contain text $msg"
chmod 644 "$rctmp"
- rm -f "$rctmp"
-
+ rm -f "$rctmp" "$rcempty"
cleanup
echo "test_config_invocation: test OK" >&2