main()
{
- local albumlist=${albumlist:-"albumlist"}
+ local albumlist="albumlist"
local lib="vorbis.sh"
check_programs || return $?
load_config || return $?
- while getopts "3fo" opt; do
+ while getopts "3fi:o" opt; do
case "$opt" in
"3") lib="mp3.sh" ;;
"f") lib="flac.sh" ;;
+ "i") albumlist="$OPTARG" ;;
"o") lib="opus.sh" ;;
*) errlog "unknown option" && return 1 ;;
esac
|| errlog "lib $LIB_PATH/$lib not found" \
|| return $?
-
[ -f "$albumlist" ] \
|| errlog "file $albumlist does not exists" \
|| return $?
assert_failure
assert_line --index 0 "❌ ERROR: file albumlist does not exists"
+}
+
+@test "failed: input file asdf not found" {
+ run main -i "asdf"
+
+ assert_failure
+ assert_line --index 0 "❌ ERROR: file asdf does not exists"
}
\ No newline at end of file