add --embed

This commit is contained in:
2026-04-29 17:42:01 -05:00
parent 5ecfd07ad2
commit ffb5cafaf3
4 changed files with 182 additions and 24 deletions
+33 -1
View File
@@ -74,7 +74,7 @@ run_test_cmd() {
fi
local output
output="$("${cmd[@]}")"
output="$("${cmd[@]}" 2>&1)"
local actualRetval=$?
declare -g CMD_OUTPUT="${output}"
@@ -88,6 +88,10 @@ run_test_cmd() {
}
test_help_option() {
add-synced-lyrics --help
}
test_bad_input() {
# incomplete args
run_test_cmd \
@@ -114,6 +118,11 @@ test_bad_input() {
1 \
add-synced-lyrics --file "${PROGPATH}" --dir "${PROGDIR}" --recurse
# non-existent flag
run_test_cmd \
1 \
add-synced-lyrics --this-flag-does-not-exist
return 0
}
@@ -174,23 +183,43 @@ test_determine_inputs_find_recurse() {
}
test_file_dry() {
setup_test_data
add-synced-lyrics --file "${GOOD_SONG}" --dry-run
}
test_directory_dry() {
setup_test_data
add-synced-lyrics --dir "${TEST_DIR}" --dry-run
}
test_directory_recurse_dry() {
setup_test_data
add-synced-lyrics --dir "${TEST_DIR}" --recurse --dry-run
}
test_good_file() {
setup_test_data
add-synced-lyrics --file "${GOOD_SONG}" --debug
test -f "${GOOD_LYRICS}"
}
test_good_file_embed() {
test_good_file
# rm "${GOOD_LYRICS}"
add-synced-lyrics --file "${GOOD_SONG}" --embed
run_test_cmd \
1 \
test -f "${GOOD_LYRICS}"
# do it again to test that embedded is picked up and valid
run_test_cmd \
0 \
add-synced-lyrics --file "${GOOD_SONG}" --embed
[[ "${CMD_OUTPUT}" == *'already has lyrics, skipping'* ]]
}
test_bad_file() {
setup_test_data
run_test_cmd \
1 \
add-synced-lyrics \
@@ -248,6 +277,7 @@ setup_test_data() {
}
TESTS=(
test_help_option
test_determine_inputs
test_determine_inputs_recurse
test_determine_inputs_find
@@ -257,6 +287,7 @@ TESTS=(
test_directory_recurse_dry
test_file_dry
test_good_file
test_good_file_embed
test_bad_file
test_directory_recurse
test_directory_recurse_ignore
@@ -376,5 +407,6 @@ if [[ $# -eq 0 ]]; then
echo
analyze_coverage
else
setup_coverage
"$@"
fi