--- /dev/null
+#!/bin/bash
+
+vorbis_errlog()
+{
+ local lastexit=$?
+ local msg="$1"
+
+ echo "❌ ERROR: $msg"
+ return $lastexit
+}
+
+mp3_check_programs()
+{
+ command -v flac > /dev/null \
+ || vorbis_errlog "command flac not found" \
+ || return $?
+ command -v lame > /dev/null \
+ || vorbis_errlog "command lame not found" \
+ || return $?
+ command -v eyeD3 > /dev/null \
+ || vorbis_errlog "command eyeD3 not found" \
+ || return $?
+ command -v parallel > /dev/null \
+ || vorbis_errlog "command parallel not found" \
+ || return $?
+}
+
+mp3_check_programs || return $?
\ No newline at end of file
--- /dev/null
+#!/usr/bin/bats
+
+setup() {
+ bats_load_library 'bats-support'
+ bats_load_library 'bats-assert'
+ source "src/lib/mp3.sh"
+}
+
+# bats test_tags=mp3:check_programs
+@test "failed: check programs missing flac" {
+ command() {
+ [ "$2" != "flac" ] || return 1
+ }
+
+ run mp3_check_programs
+
+ assert_failure
+ assert_line --index 0 "❌ ERROR: command flac not found"
+}
+
+# bats test_tags=mp3:check_programs
+@test "failed: check programs missing lame" {
+ command() {
+ [ "$2" != "lame" ] || return 1
+ }
+
+ run mp3_check_programs
+
+ assert_failure
+ assert_line --index 0 "❌ ERROR: command lame not found"
+}
+
+# bats test_tags=mp3:check_programs
+@test "failed: check programs eyeD3 oggenc" {
+ command() {
+ [ "$2" != "eyeD3" ] || return 1
+ }
+
+ run mp3_check_programs
+
+ assert_failure
+ assert_line --index 0 "❌ ERROR: command eyeD3 not found"
+}
+
+# bats test_tags=mp3:check_programs
+@test "failed: check programs missing parallel" {
+ command() {
+ [ "$2" != "parallel" ] || return 1
+ }
+
+ run mp3_check_programs
+
+ assert_failure
+ assert_line --index 0 "❌ ERROR: command parallel not found"
+}
\ No newline at end of file