OUTPUT_PATH=${OUTPUT_PATH:-"work.$$"}
}
+load_library()
+{
+ local lib="$1"
+ [ -f "$LIB_PATH/$lib" ] \
+ || errlog "lib $LIB_PATH/$lib not found" \
+ || return $?
+ source "$LIB_PATH/$lib" \
+ || errlog "could not load library $LIB_PATH/$lib" \
+ || return $?
+}
+
make_symlinks_to_work()
{
local albumlist="$1"
esac
done
- [ -f "$LIB_PATH/$lib" ] \
- || errlog "lib $LIB_PATH/$lib not found" \
- || return $?
- source "$LIB_PATH/$lib" \
- || errlog "could not load library $LIB_PATH/$lib" \
- || return $?
+ load_library "$lib" || return $?
[ -f "$albumlist" ] \
|| errlog "file $albumlist does not exists" \
mkdir --parents "$OUTPUT_PATH" || return $?
make_symlinks_to_work "$albumlist" || return $?
- encode "$OUTPUT_PATH" \
+ "${lib/.sh/}_encode" "$OUTPUT_PATH" \
|| errlog "could not encode $OUTPUT_PATH" \
|| return $?
cleanup_cover \
printf "%s\n" "$@"
} > "$ENCODE_LOG"
}
+ vorbis_encode() {
+ encode "$@"
+ }
+ flac_encode() {
+ encode "$@"
+ }
}
teardown() {
# bats test_tags=albentohandy:cleanup
@test "success: not cleanup flac with flac lib" {
+ load_library() {
+ :
+ }
+
run main -i "build/tests/albumlist" -f
assert_success
# bats test_tags=albentohandy:cleanup
@test "failed: could not cleanup flac" {
+ load_library() {
+ :
+ }
cleanup_flac() {
return 1
}