Tests for the GCONV_PATH environment variable.
authorPeter Verthez <Peter.Verthez@advalvas.be>
Sun, 17 Mar 2002 13:43:52 +0000 (13:43 +0000)
committerPeter Verthez <Peter.Verthez@advalvas.be>
Sun, 17 Mar 2002 13:43:52 +0000 (13:43 +0000)
t/path1.test [new file with mode: 0755]
t/path2.test [new file with mode: 0755]
t/pathtest.c [new file with mode: 0644]

diff --git a/t/path1.test b/t/path1.test
new file mode 100755 (executable)
index 0000000..94e7ee9
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+builddir=`pwd`
+export LD_LIBRARY_PATH=$builddir/../gedcom/.libs:$LD_LIBRARY_PATH
+unset GCONV_PATH
+$builddir/pathtest
diff --git a/t/path2.test b/t/path2.test
new file mode 100755 (executable)
index 0000000..7f55156
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+builddir=`pwd`
+export LD_LIBRARY_PATH=$builddir/../gedcom/.libs:$LD_LIBRARY_PATH
+export GCONV_PATH=./ansel
+$builddir/pathtest
diff --git a/t/pathtest.c b/t/pathtest.c
new file mode 100644 (file)
index 0000000..0208b28
--- /dev/null
@@ -0,0 +1,44 @@
+/* Test program for the Gedcom library.
+   Copyright (C) 2001, 2002 The Genes Development Team
+   This file is part of the Gedcom parser library.
+   Contributed by Peter Verthez <Peter.Verthez@advalvas.be>, 2001.
+
+   The Gedcom parser library is free software; you can redistribute it
+   and/or modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The Gedcom parser library is distributed in the hope that it will be
+   useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the Gedcom parser library; if not, write to the
+   Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* $Id$ */
+/* $Name$ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "gedcom.h"
+
+int check_gconv_path()
+{
+  char* path = getenv("GCONV_PATH");
+  if (path == NULL || strstr(path, PKGDATADIR) == NULL)
+    return 1;
+  else
+    return 0;
+}
+
+int main(int argc, char* argv[])
+{
+  char* path;
+  /* This checks whether the constructor in encoding.c is doing its work
+     properly */
+  gedcom_init();
+  exit(check_gconv_path());
+}