Imported Upstream version 0.18.3.2
[platform/upstream/gettext.git] / gettext-tools / tests / gettext-2
1 #! /bin/sh
2
3 # Test the gettext program without -e option.
4
5 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
6   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
7   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
8     ac_n= ac_c='
9 ' ac_t='        '
10   else
11     ac_n=-n ac_c= ac_t=
12   fi
13 else
14   ac_n= ac_c='\c' ac_t=
15 fi
16
17 tmpfiles=""
18 trap 'rm -fr $tmpfiles' 1 2 3 15
19
20 # Create binary test file in correct position.
21 tmpfiles="$tmpfiles gt-2"
22 test -d gt-2 || mkdir gt-2
23 test -d gt-2/LC_MESSAGES || mkdir gt-2/LC_MESSAGES
24 cp $top_srcdir/tests/test.mo gt-2/LC_MESSAGES
25
26 tmpfiles="$tmpfiles gt-test2.out"
27 : ${GETTEXT=gettext}
28 TEXTDOMAINDIR=. LANGUAGE=gt-2 \
29 ${GETTEXT} --env LC_ALL=en test 'error 3' > gt-test2.out
30
31 # Create correct file.
32 tmpfile="$tmpfiles gtmf-test2.ok"
33 echo $ac_n "error 3 translation$ac_c" > gtmf-test2.ok
34
35 : ${DIFF=diff}
36 ${DIFF} gtmf-test2.ok gt-test2.out
37 result=$?
38
39 rm -fr $tmpfiles
40
41 exit $result