Add -lm dependency for gettextlib to fix LTO build
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-3
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # When a header entry is provided by xgettext, it overrides any msgid ""
5 # present in the input.
6
7 cat <<EOF > xg-test3.in.c
8 This is a test of the xgettext functionality.
9 /* xgettext:no-c-format */
10 _("extract me")
11 Sometimes keywords can be spread apart
12 xgettext:no-c-format
13 _ ( "what about me" )
14 And even further on accasion
15 _
16 (
17 "hello"
18 )
19
20 /* no additional empty strings */
21 _("")
22 EOF
23
24 : ${XGETTEXT=xgettext}
25 # delete POT-Creation-Date: line because the date depends on local time.
26 ${XGETTEXT} --output - --no-location -k_ xg-test3.in.c 2>/dev/null \
27   | sed '/\"POT-Creation-Date:.*/d' | LC_ALL=C tr -d '\r' > xg-test3.po
28
29 cat <<EOF > xg-test3.ok
30 # SOME DESCRIPTIVE TITLE.
31 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
32 # This file is distributed under the same license as the PACKAGE package.
33 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
34 #
35 #, fuzzy
36 msgid ""
37 msgstr ""
38 "Project-Id-Version: PACKAGE VERSION\n"
39 "Report-Msgid-Bugs-To: \n"
40 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
41 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
42 "Language-Team: LANGUAGE <LL@li.org>\n"
43 "Language: \n"
44 "MIME-Version: 1.0\n"
45 "Content-Type: text/plain; charset=CHARSET\n"
46 "Content-Transfer-Encoding: 8bit\n"
47
48 #, no-c-format
49 msgid "extract me"
50 msgstr ""
51
52 msgid "what about me"
53 msgstr ""
54
55 msgid "hello"
56 msgstr ""
57 EOF
58
59 : ${DIFF=diff}
60 ${DIFF} xg-test3.ok xg-test3.po
61 result=$?
62
63 exit $result