Imported Upstream version 0.18.1.1
[platform/upstream/gettext.git] / gettext-tools / tests / msgcmp-2
1 #! /bin/sh
2
3 # Test a failing comparison.
4
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
7
8 tmpfiles="$tmpfiles mc-test2.in1 mc-test2.in2"
9 cat <<EOF > mc-test2.in1
10 msgid "one" msgstr "first"
11 msgid "two" msgstr "second"
12 msgid "three" msgstr "third"
13 msgid "four" msgstr "fourth"
14 EOF
15
16 cat <<EOF > mc-test2.in2
17 msgid "thre" msgstr "" #i.e. pretend a typo in the program
18 msgid "one" msgstr ""
19 msgid "two" msgstr ""
20 EOF
21
22 tmpfiles="$tmpfiles mc-test2.out"
23 : ${MSGCMP=msgcmp}
24 LC_MESSAGES=C LC_ALL= \
25 ${MSGCMP} mc-test2.in1 mc-test2.in2 2>&1 | grep -v '^==' | sed -e 's|[^ ]*\\msgcmp\.exe|msgcmp|' -e 's|^msgcmp\.exe|msgcmp|' | LC_ALL=C tr -d '\r' > mc-test2.out
26
27 tmpfiles="$tmpfiles mc-test2.ok"
28 cat <<EOF > mc-test2.ok
29 mc-test2.in2:1: this message is used but not defined...
30 mc-test2.in1:3: ...but this definition is similar
31 mc-test2.in1:4: warning: this message is not used
32 msgcmp: found 1 fatal error
33 EOF
34
35 : ${DIFF=diff}
36 ${DIFF} mc-test2.ok mc-test2.out
37 result=$?
38
39 rm -fr $tmpfiles
40
41 exit $result