]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
add test for albumlist file
authorBastian Dehn <hhaalo@arcor.de>
Fri, 25 Sep 2026 08:31:31 +0000 (10:31 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 25 Sep 2026 08:31:31 +0000 (10:31 +0200)
src/albentohandy
src/lib/vorbis.sh [new file with mode: 0644]
tests/albentohandy.bats
tests/test.conf

index 3af22533e6ba4ab6fbd18042e7ef7175847bc040..a5cc59b24dcbfd001727ac74f5f075f1ac83c133 100755 (executable)
@@ -36,6 +36,7 @@ load_config()
 
 main()
 {
+       local albumlist=${albumlist:-"albumlist"}
        local lib="vorbis.sh"
        check_programs || return $?
        load_config || return $?
@@ -52,6 +53,11 @@ main()
        [ -f "$LIB_PATH/$lib" ] \
                || errlog "lib $LIB_PATH/$lib not found" \
                || return $?
+
+
+       [ -f "$albumlist" ] \
+               || errlog "file $albumlist does not exists" \
+               || return $?
 }
 
 [ "$TEST_MODE" == "ON" ] && return 0
diff --git a/src/lib/vorbis.sh b/src/lib/vorbis.sh
new file mode 100644 (file)
index 0000000..e69de29
index 091dbbe3fe9215191775c2f6fc42c702adeb7823..f7524cf5179bd14c8bae19bb47d7858ece4a467d 100755 (executable)
@@ -6,12 +6,15 @@ setup() {
        mkdir --parents "build/tests"
        export TEST_MODE="ON"
        export CONFIG_FILE="tests/test.conf"
+       export LIB_PATH="src/lib"
        source src/albentohandy
 }
 
 teardown() {
        rm --recursive --force "build"
        unset TEST_MODE
+       unset CONFIG_FILE
+       unset LIB_PATH
 }
 
 @test "failed: rsync not found" {
@@ -45,31 +48,39 @@ teardown() {
 }
 
 @test "failed: lib vorbis.sh not found" {
+       LIB_PATH="build/tests/lib"
+
        run main
 
        assert_failure
-       assert_line --index 0 "❌ ERROR: lib src/lib/vorbis.sh not found"
+       assert_line --index 0 "❌ ERROR: lib build/tests/lib/vorbis.sh not found"
 }
 
 @test "failed: lib mp3.sh not found" {
+       LIB_PATH="build/tests/lib"
+
        run main -3
 
        assert_failure
-       assert_line --index 0 "❌ ERROR: lib src/lib/mp3.sh not found"
+       assert_line --index 0 "❌ ERROR: lib build/tests/lib/mp3.sh not found"
 }
 
 @test "failed: lib flac.sh not found" {
+       LIB_PATH="build/tests/lib"
+
        run main -f
 
        assert_failure
-       assert_line --index 0 "❌ ERROR: lib src/lib/flac.sh not found"
+       assert_line --index 0 "❌ ERROR: lib build/tests/lib/flac.sh not found"
 }
 
 @test "failed: lib opus.sh not found" {
+       LIB_PATH="build/tests/lib"
+
        run main -o
 
        assert_failure
-       assert_line --index 0 "❌ ERROR: lib src/lib/opus.sh not found"
+       assert_line --index 0 "❌ ERROR: lib build/tests/lib/opus.sh not found"
 }
 
 @test "failed: unknown option" {
@@ -77,4 +88,11 @@ teardown() {
 
        assert_failure
        assert_line --index 1 "❌ ERROR: unknown option"
+}
+
+@test "failed: albumlist not found" {
+       run main
+
+       assert_failure
+       assert_line --index 0 "❌ ERROR: file albumlist does not exists"
 }
\ No newline at end of file
index a169f0407ecfb1b54fcd0705f4ef3014590f021e..f28ad19f6569db715bc766d32ee0ee11605b3700 100644 (file)
@@ -1,2 +1 @@
-MUSIC_PATHES=("build/tests/music")
-LIB_PATH="src/lib"
\ No newline at end of file
+MUSIC_PATHES=("build/tests/music")
\ No newline at end of file