~win-cross-dev/win-cross/gettext

« back to all changes in this revision

Viewing changes to gettext-tools/tests/msgfilter-3

  • Committer: Nathan Osman
  • Date: 2012-08-11 05:06:52 UTC
  • Revision ID: admin@quickmediasolutions.com-20120811050652-ochkxjtonbw6kkve
Initial commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
 
 
3
# Test general filter execution with Java .properties syntax.
 
4
 
 
5
tmpfiles=""
 
6
trap 'rm -fr $tmpfiles' 1 2 3 15
 
7
 
 
8
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
 
9
  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
 
10
  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
 
11
    ac_n= ac_c='
 
12
' ac_t='        '
 
13
  else
 
14
    ac_n=-n ac_c= ac_t=
 
15
  fi
 
16
else
 
17
  ac_n= ac_c='\c' ac_t=
 
18
fi
 
19
 
 
20
# Some fold programs (like SunOS4 and FreeBSD) don't have an option to wrap at
 
21
# spaces.
 
22
echo abc | fold -b -s -w 20 >/dev/null 2>&1 || {
 
23
  echo "Skipping test: fold program not POSIX compliant"
 
24
  rm -fr $tmpfiles; exit 77
 
25
}
 
26
 
 
27
# Some fold programs (like HP-UX) insert a newline at the end, if the last
 
28
# line was not terminated with a newline and the -s option was given.
 
29
foldoutputcount=`echo $ac_n "abc$ac_c" | fold -b -s -w 20 | wc -c`
 
30
foldoutputcount=`echo "$foldoutputcount" | sed -e 's/[  ]//g'`
 
31
test "$foldoutputcount" = 3 || {
 
32
  echo "Skipping test: fold program inserts extra newline"
 
33
  rm -fr $tmpfiles; exit 77
 
34
}
 
35
 
 
36
tmpfiles="$tmpfiles mfi-test3.properties"
 
37
cat <<\EOF > mfi-test3.properties
 
38
# HEADER.
 
39
#
 
40
!=Project-Id-Version\: Bonnie Tyler\n
 
41
 
 
42
#: married-men:4
 
43
#, fuzzy
 
44
!The\ world\ is\ full\ of\ married\ men=So viele verheiratete M\u00e4nner
 
45
 
 
46
#: married-men:5
 
47
with\ wives\ who\ never\ understand=und ihre Frauen verstehen sie nicht
 
48
 
 
49
#: married-men:6
 
50
!They're\ looking\ for\ someone\ to\ share=
 
51
 
 
52
# schwer zu \u00fcbersetzen...
 
53
#: married-men:7
 
54
!the\ excitement\ of\ a\ love\ affair=
 
55
 
 
56
#: married-men:8
 
57
!Just\ as\ soon\ as\ they\ find\ you=
 
58
 
 
59
#: married-men:9
 
60
!They\ warn\ you\ and\ darn\ you=
 
61
EOF
 
62
 
 
63
tmpfiles="$tmpfiles mfi-test3.out"
 
64
: ${MSGFILTER=msgfilter}
 
65
LC_ALL=C \
 
66
${MSGFILTER} --properties-input --properties-output -i mfi-test3.properties -o mfi-test3.out fold -b -s -w 20
 
67
result=$?
 
68
test $result = 0 || { rm -fr $tmpfiles; exit 1; }
 
69
 
 
70
tmpfiles="$tmpfiles mfi-test3.ok"
 
71
cat <<\EOF > mfi-test3.ok
 
72
# HEADER.
 
73
#
 
74
!=Project-Id-Version\: \nBonnie Tyler\n
 
75
 
 
76
#: married-men:4
 
77
#, fuzzy
 
78
!The\ world\ is\ full\ of\ married\ men=So viele \nverheiratete M\u00e4nner
 
79
 
 
80
#: married-men:5
 
81
with\ wives\ who\ never\ understand=und ihre Frauen \nverstehen sie nicht
 
82
 
 
83
#: married-men:6
 
84
!They're\ looking\ for\ someone\ to\ share=
 
85
 
 
86
# schwer zu \u00fcbersetzen...
 
87
#: married-men:7
 
88
!the\ excitement\ of\ a\ love\ affair=
 
89
 
 
90
#: married-men:8
 
91
!Just\ as\ soon\ as\ they\ find\ you=
 
92
 
 
93
#: married-men:9
 
94
!They\ warn\ you\ and\ darn\ you=
 
95
EOF
 
96
 
 
97
: ${DIFF=diff}
 
98
${DIFF} mfi-test3.ok mfi-test3.out
 
99
result=$?
 
100
 
 
101
rm -fr $tmpfiles
 
102
 
 
103
exit $result