1#! /bin/sh 2. "${srcdir=.}/init.sh"; path_prepend_ . ../src 3 4# Test recognition of YCP format strings. 5 6cat <<\EOF > f-y-1.data 7# Valid: no argument 8"abc%%def" 9# Valid: one argument 10"abc%1def" 11# Valid: nine arguments 12"abc%9def" 13# Invalid: unterminated 14"abc%%def%" 15# Invalid: non-digit 16"abc%%def%x" 17# Invalid: zero 18"abc%%def%0" 19# Valid: permutation 20"abc%2def%1" 21# Valid: multiple uses of same argument 22"abc%2def%1ghi%2" 23EOF 24 25: ${XGETTEXT=xgettext} 26n=0 27while read comment; do 28 read string 29 n=`expr $n + 1` 30 cat <<EOF > f-y-1-$n.in 31_(${string}); 32EOF 33 ${XGETTEXT} -L YCP -o f-y-1-$n.po f-y-1-$n.in || Exit 1 34 test -f f-y-1-$n.po || Exit 1 35 fail= 36 if echo "$comment" | grep 'Valid:' > /dev/null; then 37 if grep ycp-format f-y-1-$n.po > /dev/null; then 38 : 39 else 40 fail=yes 41 fi 42 else 43 if grep ycp-format f-y-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-y-1-$n.in 1>&2 52 echo "Got:" 1>&2 53 cat f-y-1-$n.po 1>&2 54 Exit 1 55 fi 56 rm -f f-y-1-$n.in f-y-1-$n.po 57done < f-y-1.data 58 59Exit 0 60