echo "SYNOPSIS"
echo " albentohandy [-3fho] [-i <albumlist>]"
echo "OPTIONS"
- echo " -3 convert to mp3"
- echo " -f convert to flac with cover"
echo " -h show this usage"
echo " -i <albumlist> optional input list (default albumlist)"
- echo " -o convert to opus"
+ echo " -l <library> lib [vorbis|mp3|opus|flac|<custom>]"
}
check_programs()
check_programs || return $?
load_config || return $?
- while getopts "3fhi:o" opt; do
+ while getopts "hi:l:" opt; do
case "$opt" in
- "3") lib="mp3.sh" ;;
- "f") lib="flac.sh" ;;
"h") useage && return 0 ;;
"i") albumlist="$OPTARG" ;;
- "o") lib="opus.sh" ;;
+ "l") lib="$OPTARG.sh" ;;
*) errlog "unknown option" && useage && return 1 ;;
esac
done
assert_line --index 0 "❌ ERROR: lib build/tests/lib1/vorbis.sh not found"
}
+# bats test_tags=albentohandy:load_library,albentohandy:options
+@test "failed: lib vorbis.sh not found with param" {
+ load_config() {
+ :
+ }
+ LIB_PATH="build/tests/lib1"
+
+ run main -l vorbis
+
+ assert_failure
+ assert_line --index 0 "❌ ERROR: lib build/tests/lib1/vorbis.sh not found"
+}
+
# bats test_tags=albentohandy:load_library,albentohandy:options
@test "failed: lib mp3.sh not found" {
load_config() {
}
LIB_PATH="build/tests/lib"
- run main -3
+ run main -l mp3
assert_failure
assert_line --index 0 "❌ ERROR: lib build/tests/lib/mp3.sh not found"
}
LIB_PATH="build/tests/lib"
- run main -f
+ run main -l flac
assert_failure
assert_line --index 0 "❌ ERROR: lib build/tests/lib/flac.sh not found"
}
LIB_PATH="build/tests/lib"
- run main -o
+ run main -l opus
assert_failure
assert_line --index 0 "❌ ERROR: lib build/tests/lib/opus.sh not found"
mkdir --parents "build/tests/output/Artist1"
echo "testfile" > "build/tests/output/Artist1/file.flac"
- run main -i "build/tests/albumlist" -f
+ run main -i "build/tests/albumlist" -l flac
assert_success
[ -f "build/tests/output/Artist1/file.flac" ]
return 1
}
- run main -i "build/tests/albumlist" -f
+ run main -i "build/tests/albumlist" -l flac
assert_failure
assert_line --index 0 "❌ ERROR: could not cleanup flac"
assert_line --index 2 "SYNOPSIS"
assert_line --index 3 " albentohandy [-3fho] [-i <albumlist>]"
assert_line --index 4 "OPTIONS"
- assert_line --index 5 " -3 convert to mp3"
- assert_line --index 6 " -f convert to flac with cover"
- assert_line --index 7 " -h show this usage"
- assert_line --index 8 " -i <albumlist> optional input list (default albumlist)"
- assert_line --index 9 " -o convert to opus"
+ assert_line --index 5 " -h show this usage"
+ assert_line --index 6 " -i <albumlist> optional input list (default albumlist)"
+ assert_line --index 7 " -l <library> lib [vorbis|mp3|opus|flac|<custom>]"
+
}
# bats test_tags=albentohandy:usage
assert_line --index 4 "SYNOPSIS"
assert_line --index 5 " albentohandy [-3fho] [-i <albumlist>]"
assert_line --index 6 "OPTIONS"
- assert_line --index 7 " -3 convert to mp3"
- assert_line --index 8 " -f convert to flac with cover"
- assert_line --index 9 " -h show this usage"
- assert_line --index 10 " -i <albumlist> optional input list (default albumlist)"
- assert_line --index 11 " -o convert to opus"
+ assert_line --index 7 " -h show this usage"
+ assert_line --index 8 " -i <albumlist> optional input list (default albumlist)"
+ assert_line --index 9 " -l <library> lib [vorbis|mp3|opus|flac|<custom>]"
}
\ No newline at end of file