Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-14
1 #!/bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test for --check option.
5
6 # --check=ellipsis-unicode
7 cat <<\EOF > xg-ellipsis-u.c
8 gettext ("This is a sentence...");
9
10 ngettext ("This is a sentence", "These are sentences...", 2);
11
12 /* xgettext: no-ellipsis-unicode-check */
13 gettext ("This is another sentence...");
14
15 gettext ("This is a multi-sentence example.  This is the first sentence. "
16          "This is the second..., no it's not, this is the second sentence...\n"
17          "This is the third sentence...? Perhaps.\n");
18 EOF
19
20 : ${XGETTEXT=xgettext}
21 LANGUAGE= LC_ALL=C ${XGETTEXT} --omit-header --add-comments --check=ellipsis-unicode -d xg-ellipsis-u.tmp xg-ellipsis-u.c 2>xg-ellipsis-u.err
22
23 test `grep -c 'ASCII ellipsis' xg-ellipsis-u.err` = 4 || exit 1
24
25 LANGUAGE= LC_ALL=C ${XGETTEXT} --omit-header --add-comments --check=ellipsis-unicode --sentence-end=double-space -d xg-ellipsis-ud.tmp xg-ellipsis-u.c 2>xg-ellipsis-ud.err
26
27 test `grep -c 'ASCII ellipsis' xg-ellipsis-ud.err` = 3 || exit 1
28
29 # --check=space-ellipsis
30 cat <<\EOF > xg-space-e.c
31 gettext ("This is a sentence ...");
32
33 /* xgettext: no-space-ellipsis-check, no-ellipsis-unicode-check */
34 gettext ("This is another sentence ...");
35
36 gettext ("This is a multi-sentence example.  This is the first sentence. "
37          "This is the second..., no it's not, this is the second sentence ...\n"
38          "This is the third sentence \u2026? Perhaps.\n");
39 EOF
40
41 LANGUAGE= LC_ALL=C ${XGETTEXT} --omit-header --add-comments --check=space-ellipsis -d xg-space-e.tmp xg-space-e.c 2>xg-space-e.err
42
43 test `grep -c 'space before ellipsis' xg-space-e.err` = 3 || exit 1
44
45 # --check=quote-unicode
46 cat <<\EOF > xg-quote-u.c
47 gettext ("\"double quoted\"");
48
49 /* xgettext: no-quote-unicode-check */
50 gettext ("\"double quoted but ignored\"");
51
52 gettext ("double quoted but empty \"\"");
53
54 gettext ("\"\" double quoted but empty");
55
56 gettext ("\"foo\" \"bar\" \"baz\"");
57
58 gettext ("'single quoted'");
59
60 /* xgettext: no-quote-unicode-check */
61 gettext ("'single quoted but ignored'");
62
63 gettext ("'foo' 'bar' 'baz'");
64
65 gettext ("prefix'single quoted without surrounding spaces'suffix");
66
67 gettext ("prefix 'single quoted with surrounding spaces' suffix");
68
69 gettext ("single quoted with apostrophe, empty '' ");
70
71 gettext ("'single quoted at the beginning of string' ");
72
73 gettext (" 'single quoted at the end of string'");
74
75 gettext ("line 1\n"
76 "'single quoted at the beginning of line' \n"
77 "line 3");
78
79 gettext ("line 1\n"
80 " 'single quoted at the end of line'\n"
81 "line 3");
82
83 gettext ("`single quoted with grave'");
84
85 /* xgettext: no-quote-unicode-check */
86 gettext ("`single quoted with grave but ignored'");
87
88 gettext ("single quoted with grave, empty `'");
89
90 gettext ("`' single quoted with grave, empty");
91
92 gettext ("`double grave`");
93 EOF
94
95 LANGUAGE= LC_ALL=C ${XGETTEXT} --omit-header --add-comments --check=quote-unicode -d xg-quote-u.tmp xg-quote-u.c 2>xg-quote-u.err
96
97 test `grep -c 'ASCII double quote' xg-quote-u.err` = 4 || exit 1
98 test `grep -c 'ASCII single quote' xg-quote-u.err` = 12 || exit 1