From 7e05685ab7d75429b4b67ac58a2e5169e5535383 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Fri, 25 Sep 2026 09:23:20 +0200 Subject: [PATCH] add test for missing music pathes --- .gitignore | 1 + src/albentohandy | 5 +++++ tests/albentohandy.bats | 13 ++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c795b05 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build \ No newline at end of file diff --git a/src/albentohandy b/src/albentohandy index 687cd60..5c7f90a 100755 --- a/src/albentohandy +++ b/src/albentohandy @@ -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() diff --git a/tests/albentohandy.bats b/tests/albentohandy.bats index e3f98c5..d9dfdb1 100755 --- a/tests/albentohandy.bats +++ b/tests/albentohandy.bats @@ -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 -- 2.47.3