summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2016-05-20 19:03:40 +0900
committerDaiki Ueno <ueno@gnu.org>2016-05-20 19:03:40 +0900
commit6555704d4cd419c562e7a5b24aaf4190a79c284b (patch)
treef2fef84c67ca8e7c1e9af09e784190e83a2147a2
parent44f7525b65f08ebd21635ae83b407557722e8795 (diff)
downloadexternal_gettext-6555704d4cd419c562e7a5b24aaf4190a79c284b.zip
external_gettext-6555704d4cd419c562e7a5b24aaf4190a79c284b.tar.gz
external_gettext-6555704d4cd419c562e7a5b24aaf4190a79c284b.tar.bz2
tests: Add test for ITS search path
* gettext-tools/tests/Makefile.am (TESTS): Add new test. * gettext-tools/tests/xgettext-its-2: New file.
-rw-r--r--gettext-tools/tests/Makefile.am2
-rwxr-xr-xgettext-tools/tests/xgettext-its-262
2 files changed, 63 insertions, 1 deletions
diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am
index 20ad11c..96aa354 100644
--- a/gettext-tools/tests/Makefile.am
+++ b/gettext-tools/tests/Makefile.am
@@ -113,7 +113,7 @@ TESTS = gettext-1 gettext-2 gettext-3 gettext-4 gettext-5 gettext-6 gettext-7 \
xgettext-vala-1 \
xgettext-gsettings-1 \
xgettext-desktop-1 \
- xgettext-its-1 \
+ xgettext-its-1 xgettext-its-2 \
format-awk-1 format-awk-2 \
format-boost-1 format-boost-2 \
format-c-1 format-c-2 format-c-3 format-c-4 format-c-5 \
diff --git a/gettext-tools/tests/xgettext-its-2 b/gettext-tools/tests/xgettext-its-2
new file mode 100755
index 0000000..599d889
--- /dev/null
+++ b/gettext-tools/tests/xgettext-its-2
@@ -0,0 +1,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