| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# Simple test for consistency across scandipairs |
| 4 |
|
| 5 |
[[ -n "${AP_NOSCANDITEST}" ]] && exit 0 |
| 6 |
|
| 7 |
set -u |
| 8 |
|
| 9 |
cd "$(dirname "$0")" || exit 1 |
| 10 |
|
| 11 |
|
| 12 |
declare -a dixen=( |
| 13 |
../apertium-nob/apertium-nob.nob.dix |
| 14 |
../apertium-swe/apertium-swe.swe.dix |
| 15 |
../apertium-nno/apertium-nno.nno.dix |
| 16 |
../apertium-dan/apertium-dan.dan.dix |
| 17 |
) |
| 18 |
|
| 19 |
for dix in "${dixen[@]}"; do |
| 20 |
if [[ ! -f "${dix}" ]]; then |
| 21 |
echo "WARNING: Couldn't find ${dix}, not testing scandipars for consistency" |
| 22 |
exit 0 |
| 23 |
fi |
| 24 |
done |
| 25 |
|
| 26 |
props () { |
| 27 |
sed -n '/SCANDIPROPS/,/\/SCANDIPROPS/p' "$@"; |
| 28 |
} |
| 29 |
diffprops () { |
| 30 |
diff --label "$1" --label "$2" -u <(props "$1") <(props "$2") |
| 31 |
} |
| 32 |
|
| 33 |
for dix in "${dixen[@]:1}"; do |
| 34 |
if ! d=$(diffprops "${dixen[0]}" "${dix}"); then |
| 35 |
echo "WARNING: Found differences in SCANDIPROPS section between ${dixen[0]} and ${dix}:" |
| 36 |
echo "$d" |
| 37 |
exit 1 |
| 38 |
fi |
| 39 |
done |