Commit 9baf551a authored by Philip Withnall's avatar Philip Withnall Committed by Philip Withnall
Browse files

tests: Move nominatim-*.json to tests directory

So they are with the other test JSON files. This also removes the need
for TEST_SRCDIR — we can now use g_test_build_filename() instead, which
uses the G_TEST_SRCDIR/G_TEST_BUILDDIR environment variables which will
eventually be passed in by glib-tap.mk (in following commits).

https://bugzilla.gnome.org/show_bug.cgi?id=772928
parent fc577c64
......@@ -53,7 +53,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir) \
-DPACKAGE_VERSION=\"@PACKAGE_VERSION@\" \
-DTEST_SRCDIR=\""$(srcdir)/data/"\" \
-DGEOCODE_LOCALEDIR=\"$(localedir)\"
AM_CFLAGS = $(GEOCODE_CFLAGS) $(COMMON_CFLAGS) $(WARN_CFLAGS) $(DISABLE_DEPRECATED)
......@@ -115,9 +114,4 @@ endif # HAVE_INTROSPECTION
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST += \
data/nominatim-rio.json \
data/nominatim-area.json \
data/nominatim-no-results.json
-include $(top_srcdir)/git.mk
......@@ -11,7 +11,6 @@ TESTS_ENVIRONMENT = \
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir) \
-DTEST_SRCDIR=\""$(srcdir)/../data/"\" \
$(NULL)
AM_CFLAGS = \
......@@ -34,6 +33,9 @@ geocode_glib_LDADD = $(top_builddir)/geocode-glib/libgeocode-glib.la $(GEOCODE_L
EXTRA_DIST = \
locale_format.json \
locale_name.json \
nominatim-area.json \
nominatim-no-results.json \
nominatim-rio.json \
osm_type0.json \
osm_type1.json \
osm_type2.json \
......
......@@ -781,7 +781,9 @@ test_resolve_json (void)
char *filename;
char *value;
filename = g_strdup_printf (TEST_SRCDIR "/%s", tests[i].fname);
filename = g_test_build_filename (G_TEST_DIST,
tests[i].fname,
NULL);
if (g_file_get_contents (filename, &contents, NULL, &error) == FALSE) {
g_critical ("Couldn't load contents of '%s': %s",
filename, error->message);
......@@ -820,11 +822,14 @@ test_search_json (void)
GList *list, *l;
char *contents;
gboolean found = FALSE;
g_autofree gchar *filename = NULL;
if (g_file_get_contents (TEST_SRCDIR "/nominatim-rio.json",
&contents, NULL, &error) == FALSE) {
filename = g_test_build_filename (G_TEST_DIST, "nominatim-rio.json",
NULL);
if (g_file_get_contents (filename, &contents, NULL, &error) == FALSE) {
g_critical ("Couldn't load contents of '%s': %s",
TEST_SRCDIR "/nominatim-rio.json", error->message);
filename, error->message);
}
list = _geocode_parse_search_json (contents, &error);
g_assert_no_error (error);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment