1#!/bin/sh 2. "${srcdir=.}/init.sh"; path_prepend_ . ../src 3 4# Test for --check option. 5 6# --check=ellipsis-unicode 7cat <<\EOF > xg-ellipsis-u.c 8gettext ("This is a sentence..."); 9 10ngettext ("This is a sentence", "These are sentences...", 2); 11 12/* xgettext: no-ellipsis-unicode-check */ 13gettext ("This is another sentence..."); 14 15gettext ("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"); 18EOF 19 20: ${XGETTEXT=xgettext} 21LANGUAGE= 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 23test `grep -c 'ASCII ellipsis' xg-ellipsis-u.err` = 4 || Exit 1 24 25LANGUAGE= 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 27test `grep -c 'ASCII ellipsis' xg-ellipsis-ud.err` = 3 || Exit 1 28 29# --check=space-ellipsis 30cat <<\EOF > xg-space-e.c 31gettext ("This is a sentence ..."); 32 33/* xgettext: no-space-ellipsis-check, no-ellipsis-unicode-check */ 34gettext ("This is another sentence ..."); 35 36gettext ("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"); 39EOF 40 41LANGUAGE= 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 43test `grep -c 'space before ellipsis' xg-space-e.err` = 3 || Exit 1 44 45# --check=quote-unicode 46cat <<\EOF > xg-quote-u.c 47gettext ("\"double quoted\""); 48 49/* xgettext: no-quote-unicode-check */ 50gettext ("\"double quoted but ignored\""); 51 52gettext ("double quoted but empty \"\""); 53 54gettext ("\"\" double quoted but empty"); 55 56gettext ("\"foo\" \"bar\" \"baz\""); 57 58gettext ("'single quoted'"); 59 60/* xgettext: no-quote-unicode-check */ 61gettext ("'single quoted but ignored'"); 62 63gettext ("'foo' 'bar' 'baz'"); 64 65gettext ("prefix'single quoted without surrounding spaces'suffix"); 66 67gettext ("prefix 'single quoted with surrounding spaces' suffix"); 68 69gettext ("single quoted with apostrophe, empty '' "); 70 71gettext ("'single quoted at the beginning of string' "); 72 73gettext (" 'single quoted at the end of string'"); 74 75gettext ("line 1\n" 76"'single quoted at the beginning of line' \n" 77"line 3"); 78 79gettext ("line 1\n" 80" 'single quoted at the end of line'\n" 81"line 3"); 82 83gettext ("`single quoted with grave'"); 84 85/* xgettext: no-quote-unicode-check */ 86gettext ("`single quoted with grave but ignored'"); 87 88gettext ("single quoted with grave, empty `'"); 89 90gettext ("`' single quoted with grave, empty"); 91 92gettext ("`double grave`"); 93EOF 94 95LANGUAGE= 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 97test `grep -c 'ASCII double quote' xg-quote-u.err` = 4 || Exit 1 98test `grep -c 'ASCII single quote' xg-quote-u.err` = 12 || Exit 1 99 100# --check=bullet-unicode 101cat <<\EOF > xg-bullet-u1.c 102gettext ("The following is a list of items:\n\ 103* item 1\n\ 104* item 2\n\ 105* item 3\n"); 106EOF 107 108: ${XGETTEXT=xgettext} 109LANGUAGE= LC_ALL=C ${XGETTEXT} --omit-header --add-comments --check=bullet-unicode -d xg-bullet-u1.tmp xg-bullet-u1.c 2>xg-bullet-u1.err 110 111test `grep -c 'ASCII bullet' xg-bullet-u1.err` = 1 || { cat xg-bullet-u1.err; Exit 1; } 112 113cat <<\EOF > xg-bullet-u2.c 114gettext ("The following is a list of items:\n\ 115* item 1\n\ 116 - item 2\n\ 117* item 3\n"); 118EOF 119 120: ${XGETTEXT=xgettext} 121LANGUAGE= LC_ALL=C ${XGETTEXT} --omit-header --add-comments --check=bullet-unicode -d xg-bullet-u2.tmp xg-bullet-u2.c 2>xg-bullet-u2.err 122 123test `grep -c 'ASCII bullet' xg-bullet-u2.err` = 1 || { cat xg-bullet-u2.err; Exit 1; } 124 125cat <<\EOF > xg-bullet-u3.c 126gettext ("The following is NOT a list of items:\n\ 127* item 1\n\ 128- item 2\n\ 129* item 3\n"); 130EOF 131 132: ${XGETTEXT=xgettext} 133LANGUAGE= LC_ALL=C ${XGETTEXT} --omit-header --add-comments --check=bullet-unicode -d xg-bullet-u3.tmp xg-bullet-u3.c 2>xg-bullet-u3.err 134 135test `grep -c 'ASCII bullet' xg-bullet-u3.err` = 0 || { cat xg-bullet-u3.err; Exit 1; } 136