3 # Test checking of Perl format strings.
4 # This test is for the combination of printf and brace format strings.
7 trap 'rm -fr $tmpfiles' 1 2 3 15
9 tmpfiles
="$tmpfiles f-pm-2.data"
10 cat <<\EOF
> f-pm-2.data
12 #, perl-format, perl-brace-format
13 msgid
"{foo} %d {bar} %s"
14 msgstr
"{bar} {foo} %d %s"
15 # Invalid: missing argument.
16 #, perl-format, perl-brace-format
17 msgid
"{foo} %d {bar} %s"
19 # Valid: missing argument but checking disabled.
20 #, perl-format, no-perl-brace-format
21 msgid
"{foo} %d {bar} %s"
23 # Invalid: printf format reordered without position specifiers %1$, %2$.
24 #, perl-format, perl-brace-format
25 msgid
"{foo} %d {bar} %s"
26 msgstr
"{bar} %s {foo} %d"
27 # Valid: same thing but checking disabled.
28 #, no-perl-format, perl-brace-format
29 msgid
"{foo} %d {bar} %s"
30 msgstr
"{bar} %s {foo} %d"
31 # Invalid: unnamed vs. named arguments
35 # Invalid: named vs. unnamed arguments
43 while read comment
; do
48 tmpfiles
="$tmpfiles f-pm-2-$n.po f-pm-2-$n.mo"
49 cat <<EOF > f-pm-2-$n.po
55 if echo "$comment" |
grep 'Valid:' > /dev
/null
; then
56 if ${MSGFMT} --check-format -o f-pm-2-
$n.mo f-pm-2-
$n.po
; then
62 ${MSGFMT} --check-format -o f-pm-2-
$n.mo f-pm-2-
$n.po
2> /dev
/null
69 if test -n "$fail"; then
70 echo "Format string checking error:" 1>&2