summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/xgettext-its-2
blob: 599d889bd738bdf2b765da4bbadb5999245e5084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# Test of ITS search path.

for d in a b c xa xb xc; do
  test -d "$d" || mkdir "$d"
  base="$d"
  if expr "$d" : x 2>&1 >/dev/null; then
    test -d "$d/gettext" || mkdir "$d/gettext"
    base="$d/gettext"
  fi
  test -d "$base/its" || mkdir "$base/its"
  cat <<EOF > "$base/its/$d.loc"
<?xml version='1.0'?>
<locatingRules>
  <locatingRule pattern='*.$d'>
    <documentRule prefix='' localName='$d' target='empty.its'/>
  </locatingRule>
</locatingRules>
EOF
  cat <<EOF > "$base/its/empty.its"
<?xml version='1.0'?>
<its:rules xmlns:its='http://www.w3.org/2005/11/its' version='1.0'>
</its:rules>
EOF
  cat <<EOF > "input.$d"
<?xml version='1.0'?>
<$d>
</$d>
EOF
done

: ${XGETTEXT=xgettext}

unset GETTEXTDATADIR
unset GETTEXTDATADIRS
unset XDG_DATA_DIRS

${XGETTEXT} -o /dev/null input.a 2>&1 | grep 'is unknown; will try C' 2>&1 >/dev/null
result=$?
test $result = 0 || exit 1

GETTEXTDATADIR=a
export GETTEXTDATADIR
${XGETTEXT} -o /dev/null input.a 2>&1 | grep 'is unknown; will try C' 2>&1 >/dev/null
result=$?
test $result = 0 && exit 1

GETTEXTDATADIRS=b:a
export GETTEXTDATADIRS
${XGETTEXT} -o /dev/null input.b 2>&1 | grep 'is unknown; will try C' 2>&1 >/dev/null
result=$?
test $result = 0 && exit 1

XDG_DATA_DIRS=xa
export XDG_DATA_DIRS
${XGETTEXT} -o /dev/null input.xa 2>&1 | grep 'is unknown; will try C' 2>&1 >/dev/null
result=$?
test $result = 0 && exit 1

exit 0