Imported Upstream version 0.18.1.1
[platform/upstream/gettext.git] / gettext-tools / tests / msgcat-stringtable-1
1 #! /bin/sh
2
3 # Test reading in NeXTstep/GNUstep .strings syntax.
4
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
7
8 tmpfiles="$tmpfiles mcat-s-1.in"
9 cat <<\EOF > mcat-s-1.in
10 /* This is an example of a string table file. Everything inside a comment
11 is completely ignored, even if in "quotes", or \escape characters, etc.
12 */
13
14 "title" = "pattern II target 1";
15
16 /* This is an example of excape codes in the string table, codes */
17 /* that are not one of abfnrtv are stripped of the \ character */
18 "escapes"    = "This is a tab \t and a return \n or a \a but not a \p";
19 "escapes2"    = "Well how about a \0? Guess not.";
20
21 /* more parameters, white space between tokens is ignored */
22 "actualSize"    
23         = 
24                 "0.000250 0.000250";
25
26 /* a key with no value assumes the value is the empty string */
27 "hoe322070.element";
28 EOF
29
30 tmpfiles="$tmpfiles mcat-s-1.tmp mcat-s-1.err mcat-s-1.out"
31 rm -f mcat-s-1.tmp
32 : ${MSGCAT=msgcat}
33 LC_MESSAGES=C LC_ALL= \
34 ${MSGCAT} --stringtable-input -o mcat-s-1.tmp mcat-s-1.in >mcat-s-1.err 2>&1
35 result=$?
36 cat mcat-s-1.err | grep -v ': internationalized messages'
37 test $result = 0 || { rm -fr $tmpfiles; exit 1; }
38 LC_ALL=C tr -d '\r' < mcat-s-1.tmp > mcat-s-1.out
39 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
40
41 tmpfiles="$tmpfiles mcat-s-1.ok"
42 cat << \EOF > mcat-s-1.ok
43 # This is an example of a string table file. Everything inside a comment
44 # is completely ignored, even if in "quotes", or \escape characters, etc.
45 #
46 msgid "title"
47 msgstr "pattern II target 1"
48
49 # This is an example of excape codes in the string table, codes
50 # that are not one of abfnrtv are stripped of the \ character
51 msgid "escapes"
52 msgstr ""
53 "This is a tab \t and a return \n"
54 " or a \a but not a p"
55
56 msgid "escapes2"
57 msgstr "Well how about a "
58
59 # more parameters, white space between tokens is ignored
60 msgid "actualSize"
61 msgstr "0.000250 0.000250"
62
63 # a key with no value assumes the value is the empty string
64 msgid "hoe322070.element"
65 msgstr ""
66 EOF
67
68 : ${DIFF=diff}
69 ${DIFF} mcat-s-1.ok mcat-s-1.out
70 result=$?
71
72 rm -fr $tmpfiles
73
74 exit $result