3 # Test recognition of Perl format strings of both kinds (printf and brace).
4 # This test is for the combination of both kinds.
7 trap 'rm -fr $tmpfiles' 1 2 3 15
9 tmpfiles
="$tmpfiles f-pm-1.data"
11 cat <<\EOF
> f-pm-1.data
13 #, perl-format, perl-brace-format
14 "{foo} %c {bar} %d {baz}"
18 # printf format only, because '%' is not allowed in identifier.
21 # Valid bracketed format because there is still one valid identifier.
22 #, perl-format, perl-brace-format
24 # Bracketed format only, because %l is not recognized in printf format.
27 # Neither format recognized here.
32 : ${XGETTEXT=xgettext}
34 while read comment
; do
38 tmpfiles
="$tmpfiles f-pm-1-$n.in f-pm-1-$n.po"
39 cat <<EOF > f-pm-1-$n.in
42 ${XGETTEXT} -L perl
--omit-header --no-location -o f-pm-1-
$n.po f-pm-1-
$n.
in ||
exit 1
43 test -f f-pm-1-
$n.po ||
exit 1
45 if test -n "${formats}"; then
46 # Verify that the first line contains the expected #, comment.
47 if sed 1q
< f-pm-1-
$n.po |
grep '^'"${formats}"'$' > /dev
/null
; then
53 # Verify that there is no #, comment.
54 if sed 1q
< f-pm-1-
$n.po |
grep '^msgid' > /dev
/null
; then
60 if test -n "$fail"; then
61 echo "Format string recognition error:" 1>&2