[geocode-glib] tests: Move nominatim-*.json to tests directory



commit 9baf551a0392f09f324e775a67da45e51638ecb0
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Fri Oct 14 12:28:43 2016 +0100

    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

 geocode-glib/Makefile.am                           |    6 ------
 geocode-glib/tests/Makefile.am                     |    4 +++-
 geocode-glib/tests/geocode-glib.c                  |   13 +++++++++----
 geocode-glib/{data => tests}/nominatim-area.json   |    0
 .../{data => tests}/nominatim-no-results.json      |    0
 geocode-glib/{data => tests}/nominatim-rio.json    |    0
 6 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/geocode-glib/Makefile.am b/geocode-glib/Makefile.am
index 00700ff..284465b 100644
--- a/geocode-glib/Makefile.am
+++ b/geocode-glib/Makefile.am
@@ -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
diff --git a/geocode-glib/tests/Makefile.am b/geocode-glib/tests/Makefile.am
index 6c51e84..03d62fc 100644
--- a/geocode-glib/tests/Makefile.am
+++ b/geocode-glib/tests/Makefile.am
@@ -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 \
diff --git a/geocode-glib/tests/geocode-glib.c b/geocode-glib/tests/geocode-glib.c
index cdef599..97c0fd0 100644
--- a/geocode-glib/tests/geocode-glib.c
+++ b/geocode-glib/tests/geocode-glib.c
@@ -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);
diff --git a/geocode-glib/data/nominatim-area.json b/geocode-glib/tests/nominatim-area.json
similarity index 100%
rename from geocode-glib/data/nominatim-area.json
rename to geocode-glib/tests/nominatim-area.json
diff --git a/geocode-glib/data/nominatim-no-results.json b/geocode-glib/tests/nominatim-no-results.json
similarity index 100%
rename from geocode-glib/data/nominatim-no-results.json
rename to geocode-glib/tests/nominatim-no-results.json
diff --git a/geocode-glib/data/nominatim-rio.json b/geocode-glib/tests/nominatim-rio.json
similarity index 100%
rename from geocode-glib/data/nominatim-rio.json
rename to geocode-glib/tests/nominatim-rio.json


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]