diff options
Diffstat (limited to 'iconvdata/tst-table.sh')
-rwxr-xr-x | iconvdata/tst-table.sh | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/iconvdata/tst-table.sh b/iconvdata/tst-table.sh index bc6f542b24..7ba15bbf5c 100755 --- a/iconvdata/tst-table.sh +++ b/iconvdata/tst-table.sh @@ -37,7 +37,8 @@ set -e < ../localedata/charmaps/${charmap:-$charset} \ > ${objpfx}tst-${charset}.charmap.table # When the charset is GB18030, truncate this table because for this encoding, -# the tst-table-from and tst-table-to programs scan the Unicode BMP only. +# the charmap contains ranges (<Unnnn>..<Ummmm> notation), which the +# tst-table-charmap.sh script does not grok. if test ${charset} = GB18030; then grep '0x....$' < ${objpfx}tst-${charset}.charmap.table \ > ${objpfx}tst-${charset}.truncated.table @@ -73,25 +74,42 @@ diff ${objpfx}tst-${charset}.charmap.table ${objpfx}tst-${charset}.inverse.table # Check 1: charmap and iconv forward should be identical, except for # precomposed characters. -if test -f ${precomposed}; then - cat ${objpfx}tst-${charset}.table ${precomposed} | sort | uniq -u \ - > ${objpfx}tst-${charset}.tmp.table - cmp -s ${objpfx}tst-${charset}.charmap.table ${objpfx}tst-${charset}.tmp.table || +{ if test -f ${precomposed}; then + cat ${objpfx}tst-${charset}.table ${precomposed} | sort | uniq -u + else + cat ${objpfx}tst-${charset}.table + fi +} | { if test ${charset} = GB18030; then grep '0x....$'; else cat; fi; } \ + > ${objpfx}tst-${charset}.tmp1.table +cmp -s ${objpfx}tst-${charset}.charmap.table ${objpfx}tst-${charset}.tmp1.table || exit 1 -else - cmp -s ${objpfx}tst-${charset}.charmap.table ${objpfx}tst-${charset}.table || - exit 1 -fi # Check 2: the difference between the charmap and iconv backward. -if test -f ${irreversible}; then - cat ${objpfx}tst-${charset}.charmap.table ${irreversible} | sort | uniq -u \ - > ${objpfx}tst-${charset}.tmp.table - cmp -s ${objpfx}tst-${charset}.tmp.table ${objpfx}tst-${charset}.inverse.table || - exit 1 -else - cmp -s ${objpfx}tst-${charset}.charmap.table ${objpfx}tst-${charset}.inverse.table || +{ if test -f ${irreversible}; then + cat ${objpfx}tst-${charset}.charmap.table ${irreversible} | sort | uniq -u + else + cat ${objpfx}tst-${charset}.charmap.table + fi +} | { if test ${charset} = GB18030; then grep '0x....$'; else cat; fi; } \ + > ${objpfx}tst-${charset}.tmp2c.table +cat ${objpfx}tst-${charset}.inverse.table \ + | { if test ${charset} = GB18030; then grep '0x....$'; else cat; fi; } \ + > ${objpfx}tst-${charset}.tmp2i.table +cmp -s ${objpfx}tst-${charset}.tmp2c.table ${objpfx}tst-${charset}.tmp2i.table || exit 1 + +# Check 3: the difference between iconv forward and iconv backward. This is +# necessary only for GB18030, because ${objpfx}tst-${charset}.charmap.table +# is truncated for this encoding (see above). +if test ${charset} = GB18030; then + { if test -f ${irreversible}; then + cat ${objpfx}tst-${charset}.table ${irreversible} | sort | uniq -u + else + cat ${objpfx}tst-${charset}.table + fi + } > ${objpfx}tst-${charset}.tmp3.table + cmp -s ${objpfx}tst-${charset}.tmp3.table ${objpfx}tst-${charset}.inverse.table || + exit 1 fi exit 0 |