]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
add test for missing music pathes
authorBastian Dehn <hhaalo@arcor.de>
Fri, 25 Sep 2026 07:23:20 +0000 (09:23 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 25 Sep 2026 07:23:20 +0000 (09:23 +0200)
.gitignore [new file with mode: 0644]
src/albentohandy
tests/albentohandy.bats

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..c795b05
--- /dev/null
@@ -0,0 +1 @@
+build
\ No newline at end of file
index 687cd60cdb8504591f7289dc74a4c8ce529a9062..5c7f90adcca8de88cdc6c1e00e53c544081e462f 100755 (executable)
@@ -23,6 +23,11 @@ load_config()
        [ -f "$CONFIG_FILE" ] \
                || errlog "missing $CONFIG_FILE" \
                || return $?
+
+       source "$CONFIG_FILE"
+       [ -n "$MUSIC_PATHES" ] \
+               || errlog "missing MUSIC_PATHES in $CONFIG_FILE" \
+               || return $?
 }
 
 main()
index e3f98c5a5d2df28d0fffc465c0be2c340c19c6f5..d9dfdb1e75df678286dba0fbe48e47246e13f968 100755 (executable)
@@ -3,12 +3,14 @@
 setup() {
        bats_load_library 'bats-support'
        bats_load_library 'bats-assert'
+       mkdir --parents "build/tests"
        export TEST_MODE="ON"
-       export CONFIG_FILE="src/albentohandy.conf"
+       export CONFIG_FILE="build/tests/albentohandy.conf"
        source src/albentohandy
 }
 
 teardown() {
+       rm --recursive --force "build"
        unset TEST_MODE
 }
 
@@ -30,4 +32,13 @@ teardown() {
 
        assert_failure
        assert_line --index 0 "❌ ERROR: missing src/nothing.conf"
+}
+
+@test "failed: missing MUSIC_PATHES" {
+       touch build/tests/albentohandy.conf
+
+       run main
+
+       assert_failure
+       assert_line --index 0 "❌ ERROR: missing MUSIC_PATHES in build/tests/albentohandy.conf"
 }
\ No newline at end of file