summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFélix Piédallu <felix@piedallu.me>2020-02-20 16:00:10 +0100
committerBastien Nocera <hadess@hadess.net>2020-02-20 18:00:16 +0100
commit6fb21a2046d93f66f4625c0bcddfc5fbef27c501 (patch)
tree8359bfe48546d80aa111ba8609f148c54ef53bdf /tests
parentb1662f0ca3d3f68ff1b7a1a5ebeafd915c1f7820 (diff)
downloadshared-mime-info-6fb21a2046d93f66f4625c0bcddfc5fbef27c501.tar.gz
build: Add script to check for duplicated mime-types
Replaces the shell in Makefile.am
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_duplicate_mime_types.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_duplicate_mime_types.sh b/tests/test_duplicate_mime_types.sh
new file mode 100755
index 00000000..401b383d
--- /dev/null
+++ b/tests/test_duplicate_mime_types.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+xml_db_file="${1}"
+
+duplicated=$(
+ grep '<mime-type' ${xml_db_file} | tr -d '[:blank:]' | sort | uniq -d
+)
+
+if [[ -n "${duplicated}" ]]; then
+ echo "*************************************************************"
+ echo "** Some mime-types are duplicated, fix before committing: **"
+ echo "${duplicated}"
+ echo "*************************************************************"
+ exit 1
+fi