"h") useage && return 0 ;;
"i") albumlist="$OPTARG" ;;
"o") lib="opus.sh" ;;
- *) errlog "unknown option" && return 1 ;;
+ *) errlog "unknown option" && useage && return 1 ;;
esac
done
assert_line --index 6 " -f convert to flac with cover"
assert_line --index 7 " -h show this usage"
assert_line --index 8 " -o convert to opus"
+}
+
+# bats test_tags=albentohandy:usage
+@test "failure: print usage by unknown command" {
+ run main -x
+
+ assert_failure
+ assert_line --index 1 "❌ ERROR: unknown option"
+ assert_line --index 2 "NAME"
+ assert_line --index 3 " albentohandy - convert flac to ogg, mp3, opus or flac from music collection"
+ assert_line --index 4 "SYNOPSIS"
+ assert_line --index 5 " albentohandy [-3fho]"
+ assert_line --index 6 "OPTIONS"
+ assert_line --index 7 " -3 convert to mp3"
+ assert_line --index 8 " -f convert to flac with cover"
+ assert_line --index 9 " -h show this usage"
+ assert_line --index 10 " -o convert to opus"
}
\ No newline at end of file