From 0cae5d601a8584389637ece1fa19f5b8e02b6e02 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Fri, 25 Sep 2026 10:12:03 +0200 Subject: [PATCH] add tests for other libs failed by missing --- src/albentohandy | 9 +++++++++ tests/albentohandy.bats | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/albentohandy b/src/albentohandy index 25e366e..9bfbfb8 100755 --- a/src/albentohandy +++ b/src/albentohandy @@ -36,6 +36,15 @@ main() check_programs || return $? load_config || return $? + while getopts "3fo" opt; do + case "$opt" in + "3") lib="mp3.sh" ;; + "f") lib="flac.sh" ;; + "o") lib="opus.sh" ;; + *) errlog "unknown option" && return 1 ;; + esac + done + [ -f "$LIB_PATH/$lib" ] \ || errlog "lib $LIB_PATH/$lib not found" \ || return $? diff --git a/tests/albentohandy.bats b/tests/albentohandy.bats index ebead4d..091dbbe 100755 --- a/tests/albentohandy.bats +++ b/tests/albentohandy.bats @@ -49,4 +49,32 @@ teardown() { assert_failure assert_line --index 0 "❌ ERROR: lib src/lib/vorbis.sh not found" +} + +@test "failed: lib mp3.sh not found" { + run main -3 + + assert_failure + assert_line --index 0 "❌ ERROR: lib src/lib/mp3.sh not found" +} + +@test "failed: lib flac.sh not found" { + run main -f + + assert_failure + assert_line --index 0 "❌ ERROR: lib src/lib/flac.sh not found" +} + +@test "failed: lib opus.sh not found" { + run main -o + + assert_failure + assert_line --index 0 "❌ ERROR: lib src/lib/opus.sh not found" +} + +@test "failed: unknown option" { + run main -x + + assert_failure + assert_line --index 1 "❌ ERROR: unknown option" } \ No newline at end of file -- 2.47.3