main()
{
+ local albumlist=${albumlist:-"albumlist"}
local lib="vorbis.sh"
check_programs || return $?
load_config || return $?
[ -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
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" {
}
@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" {
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