Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / msgcmp-2
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test a failing comparison.
5
6 cat <<EOF > mc-test2.in1
7 msgid "one" msgstr "first"
8 msgid "two" msgstr "second"
9 msgid "three" msgstr "third"
10 msgid "four" msgstr "fourth"
11 EOF
12
13 cat <<EOF > mc-test2.in2
14 msgid "thre" msgstr "" #i.e. pretend a typo in the program
15 msgid "one" msgstr ""
16 msgid "two" msgstr ""
17 EOF
18
19 : ${MSGCMP=msgcmp}
20 LC_MESSAGES=C LC_ALL= \
21 ${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
22
23 cat <<EOF > mc-test2.ok
24 mc-test2.in2:1: this message is used but not defined...
25 mc-test2.in1:3: ...but this definition is similar
26 mc-test2.in1:4: warning: this message is not used
27 msgcmp: found 1 fatal error
28 EOF
29
30 : ${DIFF=diff}
31 ${DIFF} mc-test2.ok mc-test2.out
32 result=$?
33
34 exit $result