summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/xgettext-objc-1
blob: 9a5e122719ea53eb09d50dc23f18913de021566f (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#! /bin/sh

# Test ObjectiveC extractor.

tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15

tmpfiles="$tmpfiles xg-ob-1.m"
cat <<\EOF > xg-ob-1.m
id str = _(@
"conca" /* comment */
@
// another comment
 "tenated");

_(@"foo") _ ( @"foo2" /* test */ )

"_()"

"  \" _(foo) \" /* comment "

_ // test
(@ /* comment " */ "test"
@
" test2"
)

NSLocalizedString(@"Information", @"")
EOF

tmpfiles="$tmpfiles xg-ob-1.tmp.po xg-ob-1.po"
: ${XGETTEXT=xgettext}
${XGETTEXT} --omit-header -k_ -kNSLocalizedString -d xg-ob-1.tmp xg-ob-1.m
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
tr -d '\r' < xg-ob-1.tmp.po > xg-ob-1.po
test $? = 0 || { rm -fr $tmpfiles; exit 1; }

tmpfiles="$tmpfiles xg-ob-1.ok"
cat <<\EOF > xg-ob-1.ok
#: xg-ob-1.m:2
msgid "concatenated"
msgstr ""

#: xg-ob-1.m:7
msgid "foo"
msgstr ""

#: xg-ob-1.m:7
msgid "foo2"
msgstr ""

#: xg-ob-1.m:14
msgid "test test2"
msgstr ""

#: xg-ob-1.m:19
msgid "Information"
msgstr ""
EOF

: ${DIFF=diff}
${DIFF} xg-ob-1.ok xg-ob-1.po
result=$?

rm -fr $tmpfiles

exit $result