+#!/bin/bash
+
+flac_errlog()
+{
+ local lastexit=$?
+ local msg="$1"
+
+ echo "❌ ERROR: $msg"
+ return $lastexit
+}
+
+flac_check_programs()
+{
+ command -v metaflac > /dev/null \
+ || flac_errlog "command metaflac not found" \
+ || return $?
+}
+
+flac_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/flac.sh"
+}
+
+# bats test_tag=flac:check_programs
+@test "failed: check programs missing metaflac" {
+ command() {
+ [ "$2" != "metaflac" ] || return 1
+ }
+
+ run flac_check_programs
+
+ assert_failure
+ assert_line --index 0 "❌ ERROR: command metaflac not found"
+}
\ No newline at end of file