summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/test_duplicate_mime_types.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/test_duplicate_mime_types.sh b/tests/test_duplicate_mime_types.sh
index 401b383d..e7dfb150 100755
--- a/tests/test_duplicate_mime_types.sh
+++ b/tests/test_duplicate_mime_types.sh
@@ -1,9 +1,17 @@
#!/usr/bin/env bash
+set -euo pipefail
+: ${1:?filename argument missing}
xml_db_file="${1}"
+test -f ${xml_db_file} || {
+ printf "%s: no such file\n" ${xml_db_file} >&2
+ exit 1
+}
duplicated=$(
- grep '<mime-type' ${xml_db_file} | tr -d '[:blank:]' | sort | uniq -d
+ xmllint --xpath \
+ "//*[local-name()='mime-type' or local-name()='alias']/@type" \
+ ${xml_db_file} | tr ' ' '\n' | sort | uniq -d
)
if [[ -n "${duplicated}" ]]; then