]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
add test for missing config file
authorBastian Dehn <hhaalo@arcor.de>
Fri, 25 Sep 2026 07:16:53 +0000 (09:16 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 25 Sep 2026 07:16:53 +0000 (09:16 +0200)
src/albentohandy
tests/albentohandy.bats

index ae8107fd214572d8cb0150c9e40220ad946d9911..c19e75c18a107b6281a1369d5a458772de4faed1 100755 (executable)
@@ -14,6 +14,12 @@ main()
        command -v rsync > /dev/null \
                || errlog "command rsync not found" \
                || return $?
+
+       CONFIG_FILE=${CONFIG_FILE:="$HOME/.albentohandy.conf"}
+
+       [ -f "$CONFIG_FILE" ] \
+               || errlog "missing $CONFIG_FILE" \
+               || return $?
 }
 
 [ "$TEST_MODE" == "ON" ] && return 0
index 7180ddd9335a76a0c3bf58b0cb399b1acf1c1e0d..e3f98c5a5d2df28d0fffc465c0be2c340c19c6f5 100755 (executable)
@@ -4,6 +4,7 @@ setup() {
        bats_load_library 'bats-support'
        bats_load_library 'bats-assert'
        export TEST_MODE="ON"
+       export CONFIG_FILE="src/albentohandy.conf"
        source src/albentohandy
 }
 
@@ -20,4 +21,13 @@ teardown() {
 
        assert_failure
        assert_line --index 0 "❌ ERROR: command rsync not found"
+}
+
+@test "failed: missing albumtohandy.conf" {
+       CONFIG_FILE="src/nothing.conf"
+
+       run main
+
+       assert_failure
+       assert_line --index 0 "❌ ERROR: missing src/nothing.conf"
 }
\ No newline at end of file