1#! /bin/sh 2. "${srcdir=.}/init.sh"; path_prepend_ . ../src 3 4# Test recognition of Qt format strings. 5 6cat <<\EOF > f-qt-1.data 7# Unrecognized: no argument 8"abc%%def" 9# Valid: one argument 10"abc%1def" 11# Valid: one argument 12"abc%9def" 13# Valid: one argument specified by two digits 14"abc%09def" 15# Valid: one argument specified by two digits 16"abc%99def" 17# Valid: unterminated 18"abc%1def%" 19# Valid: unterminated 20"abc%1def%L" 21# Valid: non-digit 22"abc%1def%x" 23# Valid: zero 24"abc%1def%0" 25# Valid: zero specified by two digits 26"abc%1def%00" 27# Valid: permutation 28"abc%2def%1" 29# Valid: multiple uses of same argument 30"abc%2def%1ghi%2" 31# Valid: an argument with locale-dependency flag 32"abc%L1def" 33# Valid: an argument with locale-dependency flag and two digits 34"abc%L12def" 35EOF 36 37: ${XGETTEXT=xgettext} 38n=0 39while read comment; do 40 read string 41 n=`expr $n + 1` 42 cat <<EOF > f-qt-1-$n.in 43_(${string}); 44EOF 45 ${XGETTEXT} -L C++ --qt -k_ -o f-qt-1-$n.po f-qt-1-$n.in || Exit 1 46 test -f f-qt-1-$n.po || Exit 1 47 fail= 48 if echo "$comment" | grep 'Valid:' > /dev/null; then 49 if grep qt-format f-qt-1-$n.po > /dev/null; then 50 : 51 else 52 fail=yes 53 fi 54 else 55 if grep qt-format f-qt-1-$n.po > /dev/null; then 56 fail=yes 57 else 58 : 59 fi 60 fi 61 if test -n "$fail"; then 62 echo "Format string recognition error:" 1>&2 63 cat f-qt-1-$n.in 1>&2 64 echo "Got:" 1>&2 65 cat f-qt-1-$n.po 1>&2 66 Exit 1 67 fi 68 rm -f f-qt-1-$n.in f-qt-1-$n.po 69done < f-qt-1.data 70 71Exit 0 72