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