Imported Upstream version 0.18.3.2
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-lua-1
1 #!/bin/sh
2
3 # Test Lua support
4
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
7
8 tmpfiles="$tmpfiles xg-lu-1.lua"
9 cat <<\EOF > xg-lu-1.lua
10 print(_("This is a test string."))
11 print(_('And another one.'))
12 print(_("Don't be afraid to extract this one."))
13 print(_('I don\'t bite!'))
14 print(_("I said: \"This is a test.\""))
15 print(_('He said: "You\'re right!"'))
16 print(_([[I like brackets.]]))
17 print(_([===[Brackets are awesome!]===]))
18 print(_(hmm["nope"]))
19 print({_"yep"})
20 print(_["nope"])
21 print(_("\097"))
22 print(_("\x3F\z         
23 \x2a"))
24 print(_("abc" .. "def"))
25 print(speed / 1000 .. 'Mbps')
26 EOF
27
28 tmpfiles="$tmpfiles xg-lu-1.tmp.po xg-lu-1.po"
29 : ${XGETTEXT=xgettext}
30 ${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
31   -d xg-lu-1.tmp xg-lu-1.lua
32 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
33 LC_ALL=C tr -d '\r' < xg-lu-1.tmp.po > xg-lu-1.po
34 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
35
36 tmpfiles="$tmpfiles xg-lu-1.ok"
37 cat <<EOF > xg-lu-1.ok
38 msgid "This is a test string."
39 msgstr ""
40
41 msgid "And another one."
42 msgstr ""
43
44 msgid "Don't be afraid to extract this one."
45 msgstr ""
46
47 msgid "I don't bite!"
48 msgstr ""
49
50 msgid "I said: \"This is a test.\""
51 msgstr ""
52
53 msgid "He said: \"You're right!\""
54 msgstr ""
55
56 msgid "I like brackets."
57 msgstr ""
58
59 msgid "Brackets are awesome!"
60 msgstr ""
61
62 msgid "yep"
63 msgstr ""
64
65 msgid "a"
66 msgstr ""
67
68 msgid "?*"
69 msgstr ""
70
71 msgid "abcdef"
72 msgstr ""
73 EOF
74
75 : ${DIFF=diff}
76 ${DIFF} xg-lu-1.ok xg-lu-1.po
77 result=$?
78
79 rm -fr $tmpfiles
80
81 exit $result