]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
add test create output path
authorBastian Dehn <hhaalo@arcor.de>
Fri, 25 Sep 2026 08:45:36 +0000 (10:45 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 25 Sep 2026 08:45:36 +0000 (10:45 +0200)
src/albentohandy
tests/albentohandy.bats
tests/test.conf

index 9829bad988689e33d9253db4084973e8172c270b..3b26c10e6f980086637b5b172939ad072c73f467 100755 (executable)
@@ -32,6 +32,7 @@ load_config()
                || errlog "missing MUSIC_PATHES in $CONFIG_FILE" \
                || return $?
        LIB_PATH=${LIB_PATH:-"$scriptpath/lib"}
+       OUTPUT_PATH=${OUTPUT_PATH:-"work.$$"}
 }
 
 main()
@@ -58,6 +59,8 @@ main()
        [ -f "$albumlist" ] \
                || errlog "file $albumlist does not exists" \
                || return $?
+
+       mkdir --parents "$OUTPUT_PATH"
 }
 
 [ "$TEST_MODE" == "ON" ] && return 0
index a51f918b4048703e0493d4e5108b39851c841eb2..dff5daef1c74018ef05f38bdbb766ae48bc54cd3 100755 (executable)
@@ -4,6 +4,7 @@ setup() {
        bats_load_library 'bats-support'
        bats_load_library 'bats-assert'
        mkdir --parents "build/tests"
+       touch "build/tests/albumlist"
        export TEST_MODE="ON"
        export CONFIG_FILE="tests/test.conf"
        export LIB_PATH="src/lib"
@@ -102,4 +103,11 @@ teardown() {
 
        assert_failure
        assert_line --index 0 "❌ ERROR: file asdf does not exists"
+}
+
+@test "success: create output path" {
+       run main -i "build/tests/albumlist"
+
+       assert_success
+       [ -d "build/tests/output" ]
 }
\ No newline at end of file
index f28ad19f6569db715bc766d32ee0ee11605b3700..8853183312ca0cb91cda8734a6fb49944e975063 100644 (file)
@@ -1 +1,2 @@
-MUSIC_PATHES=("build/tests/music")
\ No newline at end of file
+MUSIC_PATHES=("build/tests/music")
+OUTPUT_PATH="build/tests/output"
\ No newline at end of file