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