2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test checking of Perl format strings.
5 # This test is for the combination of printf and brace format strings.
7 cat <<\EOF > f-pm-2.data
9 #, perl-format, perl-brace-format
10 msgid "{foo} %d {bar} %s"
11 msgstr "{bar} {foo} %d %s"
12 # Invalid: missing argument.
13 #, perl-format, perl-brace-format
14 msgid "{foo} %d {bar} %s"
16 # Valid: missing argument but checking disabled.
17 #, perl-format, no-perl-brace-format
18 msgid "{foo} %d {bar} %s"
20 # Invalid: printf format reordered without position specifiers %1$, %2$.
21 #, perl-format, perl-brace-format
22 msgid "{foo} %d {bar} %s"
23 msgstr "{bar} %s {foo} %d"
24 # Valid: same thing but checking disabled.
25 #, no-perl-format, perl-brace-format
26 msgid "{foo} %d {bar} %s"
27 msgstr "{bar} %s {foo} %d"
28 # Invalid: unnamed vs. named arguments
32 # Invalid: named vs. unnamed arguments
40 while read comment; do
45 cat <<EOF > f-pm-2-$n.po
51 if echo "$comment" | grep 'Valid:' > /dev/null; then
52 if ${MSGFMT} --check-format -o f-pm-2-$n.mo f-pm-2-$n.po; then
58 ${MSGFMT} --check-format -o f-pm-2-$n.mo f-pm-2-$n.po 2> /dev/null
65 if test -n "$fail"; then
66 echo "Format string checking error:" 1>&2