summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/xgettext-c-8
blob: 48f160c3143129ca9e71cb6ad219b23326b81d66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# Test recognition of ISO C 99 <inttypes.h> format string directives.

cat <<EOF > xg-c-8.c
void foo ()
{
  printf (_("File size is: %" PRId64), size);
  printf (_("File age is %10" PRIdMAX " microseconds"), age);
  printf (_(PRIXFAST16 " errors"), nerrs);
  printf (_(PRIXFAT16 " mistakes"), nerrs);
}
EOF

: ${XGETTEXT=xgettext}
${XGETTEXT} --omit-header --no-location -k_ -o xg-c-8.tmp xg-c-8.c || exit 1
LC_ALL=C tr -d '\r' < xg-c-8.tmp > xg-c-8.po || exit 1

cat <<EOF > xg-c-8.ok
#, c-format
msgid "File size is: %<PRId64>"
msgstr ""

#, c-format
msgid "File age is %10<PRIdMAX> microseconds"
msgstr ""

#, c-format
msgid "<PRIXFAST16> errors"
msgstr ""

#, c-format
msgid " mistakes"
msgstr ""
EOF

: ${DIFF=diff}
${DIFF} xg-c-8.ok xg-c-8.po
result=$?

exit $result