func-assert-eq.sh 237 B

12345678910111213141516
  1. #!/usr/bin/env bash
  2. assert_eq() {
  3. local test_name=$1
  4. local want=$2
  5. local got=$3
  6. if [[ "$want" = "$got" ]]; then
  7. echo "✅ $test_name"
  8. else
  9. cat <<EOF
  10. ❌ $test_name
  11. $(diff -u <(echo "$want") <(echo "$got"))
  12. EOF
  13. fi
  14. }