Rename G_TEST_DISTED to G_TEST_DIST

Since this feature is so utterly automake-centric, we may as well be
using the same terminology as automake itself (ie: although it's
BUILT_SOURCES, it's DIST_EXTRA, not DISTED).

Also add some comments to the enum explaining that these terms are
really corresponding directly to the automake terms.

https://bugzilla.gnome.org/show_bug.cgi?id=549783
This commit is contained in:
Ryan Lortie 2013-05-29 08:49:16 -04:00
parent da478acd3c
commit 8df1bb3486
14 changed files with 77 additions and 63 deletions

View File

@ -15,7 +15,7 @@ test_launch (void)
const gchar *path; const gchar *path;
gchar *uri; gchar *uri;
path = g_test_get_filename (G_TEST_DISTED, "appinfo-test.desktop", NULL); path = g_test_get_filename (G_TEST_DIST, "appinfo-test.desktop", NULL);
appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path); appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path);
g_assert (appinfo != NULL); g_assert (appinfo != NULL);
@ -36,7 +36,7 @@ test_launch (void)
g_object_unref (file); g_object_unref (file);
l = NULL; l = NULL;
uri = g_strconcat ("file://", g_test_get_dir (G_TEST_DISTED), "/appinfo-test.desktop", NULL); uri = g_strconcat ("file://", g_test_get_dir (G_TEST_DIST), "/appinfo-test.desktop", NULL);
l = g_list_append (l, uri); l = g_list_append (l, uri);
l = g_list_append (l, "file:///etc/group#adm"); l = g_list_append (l, "file:///etc/group#adm");
@ -59,7 +59,7 @@ test_locale (const char *locale)
g_setenv ("LANGUAGE", locale, TRUE); g_setenv ("LANGUAGE", locale, TRUE);
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
path = g_test_get_filename (G_TEST_DISTED, "appinfo-test.desktop", NULL); path = g_test_get_filename (G_TEST_DIST, "appinfo-test.desktop", NULL);
appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path); appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path);
if (g_strcmp0 (locale, "C") == 0) if (g_strcmp0 (locale, "C") == 0)
@ -104,7 +104,7 @@ test_basic (void)
GIcon *icon, *icon2; GIcon *icon, *icon2;
const gchar *path; const gchar *path;
path = g_test_get_filename (G_TEST_DISTED, "appinfo-test.desktop", NULL); path = g_test_get_filename (G_TEST_DIST, "appinfo-test.desktop", NULL);
appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path); appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path);
g_assert_cmpstr (g_app_info_get_id (appinfo), ==, "appinfo-test.desktop"); g_assert_cmpstr (g_app_info_get_id (appinfo), ==, "appinfo-test.desktop");
@ -132,17 +132,17 @@ test_show_in (void)
g_desktop_app_info_set_desktop_env ("GNOME"); g_desktop_app_info_set_desktop_env ("GNOME");
path = g_test_get_filename (G_TEST_DISTED, "appinfo-test.desktop", NULL); path = g_test_get_filename (G_TEST_DIST, "appinfo-test.desktop", NULL);
appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path); appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path);
g_assert (g_app_info_should_show (appinfo)); g_assert (g_app_info_should_show (appinfo));
g_object_unref (appinfo); g_object_unref (appinfo);
path = g_test_get_filename (G_TEST_DISTED, "appinfo-test-gnome.desktop", NULL); path = g_test_get_filename (G_TEST_DIST, "appinfo-test-gnome.desktop", NULL);
appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path); appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path);
g_assert (g_app_info_should_show (appinfo)); g_assert (g_app_info_should_show (appinfo));
g_object_unref (appinfo); g_object_unref (appinfo);
path = g_test_get_filename (G_TEST_DISTED, "appinfo-test-notgnome.desktop", NULL); path = g_test_get_filename (G_TEST_DIST, "appinfo-test-notgnome.desktop", NULL);
appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path); appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path);
g_assert (!g_app_info_should_show (appinfo)); g_assert (!g_app_info_should_show (appinfo));
g_object_unref (appinfo); g_object_unref (appinfo);
@ -282,7 +282,7 @@ test_tryexec (void)
GAppInfo *appinfo; GAppInfo *appinfo;
const gchar *path; const gchar *path;
path = g_test_get_filename (G_TEST_DISTED, "appinfo-test2.desktop", NULL); path = g_test_get_filename (G_TEST_DIST, "appinfo-test2.desktop", NULL);
appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path); appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path);
g_assert (appinfo == NULL); g_assert (appinfo == NULL);
@ -403,7 +403,7 @@ test_startup_wm_class (void)
const char *wm_class; const char *wm_class;
const gchar *path; const gchar *path;
path = g_test_get_filename (G_TEST_DISTED, "appinfo-test.desktop", NULL); path = g_test_get_filename (G_TEST_DIST, "appinfo-test.desktop", NULL);
appinfo = g_desktop_app_info_new_from_filename (path); appinfo = g_desktop_app_info_new_from_filename (path);
wm_class = g_desktop_app_info_get_startup_wm_class (appinfo); wm_class = g_desktop_app_info_get_startup_wm_class (appinfo);
@ -419,7 +419,7 @@ test_supported_types (void)
const char * const *content_types; const char * const *content_types;
const gchar *path; const gchar *path;
path = g_test_get_filename (G_TEST_DISTED, "appinfo-test.desktop", NULL); path = g_test_get_filename (G_TEST_DIST, "appinfo-test.desktop", NULL);
appinfo = G_APP_INFO (g_desktop_app_info_new_from_filename (path)); appinfo = G_APP_INFO (g_desktop_app_info_new_from_filename (path));
content_types = g_app_info_get_supported_types (appinfo); content_types = g_app_info_get_supported_types (appinfo);
@ -441,7 +441,7 @@ test_from_keyfile (void)
const gchar *name; const gchar *name;
const gchar *path; const gchar *path;
path = g_test_get_filename (G_TEST_DISTED, "appinfo-test.desktop", NULL); path = g_test_get_filename (G_TEST_DIST, "appinfo-test.desktop", NULL);
kf = g_key_file_new (); kf = g_key_file_new ();
g_key_file_load_from_file (kf, path, G_KEY_FILE_NONE, &error); g_key_file_load_from_file (kf, path, G_KEY_FILE_NONE, &error);
g_assert_no_error (error); g_assert_no_error (error);

View File

@ -188,7 +188,7 @@ main (int argc, char **argv)
g_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
test_file = g_test_build_filename (G_TEST_DISTED, "contexts.c", NULL); test_file = g_test_build_filename (G_TEST_DIST, "contexts.c", NULL);
g_file_get_contents (test_file, &test_file_buffer, g_file_get_contents (test_file, &test_file_buffer,
&test_file_size, &error); &test_file_size, &error);
g_assert_no_error (error); g_assert_no_error (error);

View File

@ -84,7 +84,7 @@ test_type (void)
GFileType type; GFileType type;
GError *error = NULL; GError *error = NULL;
datapath_f = g_file_new_for_path (g_test_get_dir (G_TEST_DISTED)); datapath_f = g_file_new_for_path (g_test_get_dir (G_TEST_DIST));
file = g_file_get_child (datapath_f, "g-icon.c"); file = g_file_get_child (datapath_f, "g-icon.c");
type = g_file_query_file_type (file, 0, NULL); type = g_file_query_file_type (file, 0, NULL);

View File

@ -466,7 +466,7 @@ test_file_icon (void)
GInputStream *stream; GInputStream *stream;
gchar *str; gchar *str;
file = g_file_new_for_path (g_test_get_filename (G_TEST_DISTED, "g-icon.c", NULL)); file = g_file_new_for_path (g_test_get_filename (G_TEST_DIST, "g-icon.c", NULL));
icon = g_file_icon_new (file); icon = g_file_icon_new (file);
g_object_unref (file); g_object_unref (file);

View File

@ -787,7 +787,7 @@ test_peer (void)
gsize len; gsize len;
gchar *buf2; gchar *buf2;
gsize len2; gsize len2;
const char *testfile = g_test_get_filename (G_TEST_DISTED, "file.c", NULL); const char *testfile = g_test_get_filename (G_TEST_DIST, "file.c", NULL);
method_call_message = g_dbus_message_new_method_call (NULL, /* name */ method_call_message = g_dbus_message_new_method_call (NULL, /* name */
"/org/gtk/GDBus/PeerTestObject", "/org/gtk/GDBus/PeerTestObject",

View File

@ -18,7 +18,7 @@ test_schema_do_compile (gpointer data)
{ {
SchemaTest *test = (SchemaTest *) data; SchemaTest *test = (SchemaTest *) data;
gchar *filename = g_strconcat (test->name, ".gschema.xml", NULL); gchar *filename = g_strconcat (test->name, ".gschema.xml", NULL);
gchar *path = g_test_build_filename (G_TEST_DISTED, "schema-tests", filename, NULL); gchar *path = g_test_build_filename (G_TEST_DIST, "schema-tests", filename, NULL);
gchar *argv[] = { gchar *argv[] = {
(gchar*)glib_compile_schemas, (gchar*)glib_compile_schemas,
"--strict", "--strict",

View File

@ -2257,7 +2257,7 @@ main (int argc, char *argv[])
backend_set = g_getenv ("GSETTINGS_BACKEND") != NULL; backend_set = g_getenv ("GSETTINGS_BACKEND") != NULL;
g_setenv ("XDG_DATA_DIRS", g_test_get_dir (G_TEST_DISTED), TRUE); g_setenv ("XDG_DATA_DIRS", g_test_get_dir (G_TEST_DIST), TRUE);
g_setenv ("GSETTINGS_SCHEMA_DIR", ".", TRUE); g_setenv ("GSETTINGS_SCHEMA_DIR", ".", TRUE);
if (!backend_set) if (!backend_set)
@ -2269,7 +2269,7 @@ main (int argc, char *argv[])
glib_mkenums = "glib-mkenums"; glib_mkenums = "glib-mkenums";
cmdline = g_strdup_printf ("%s --template %s/enums.xml.template %s/testenum.h", glib_mkenums, cmdline = g_strdup_printf ("%s --template %s/enums.xml.template %s/testenum.h", glib_mkenums,
g_test_get_dir (G_TEST_DISTED), g_test_get_dir (G_TEST_DISTED)); g_test_get_dir (G_TEST_DIST), g_test_get_dir (G_TEST_DIST));
g_assert (g_spawn_command_line_sync (cmdline, &enums, NULL, &result, NULL)); g_assert (g_spawn_command_line_sync (cmdline, &enums, NULL, &result, NULL));
g_assert (result == 0); g_assert (result == 0);
@ -2283,7 +2283,7 @@ main (int argc, char *argv[])
else else
glib_compile_schemas = "glib-compile-schemas"; glib_compile_schemas = "glib-compile-schemas";
cmdline = g_strdup_printf ("%s --targetdir=. --schema-file=org.gtk.test.enums.xml --schema-file=%s/org.gtk.test.gschema.xml", glib_compile_schemas, g_test_get_dir (G_TEST_DISTED)); cmdline = g_strdup_printf ("%s --targetdir=. --schema-file=org.gtk.test.enums.xml --schema-file=%s/org.gtk.test.gschema.xml", glib_compile_schemas, g_test_get_dir (G_TEST_DIST));
g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL, &result, NULL)); g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL, &result, NULL));
g_assert (result == 0); g_assert (result == 0);
g_free (cmdline); g_free (cmdline);
@ -2291,7 +2291,7 @@ main (int argc, char *argv[])
g_mkdir ("schema-source", 0777); g_mkdir ("schema-source", 0777);
g_remove ("schema-source/gschemas.compiled"); g_remove ("schema-source/gschemas.compiled");
cmdline = g_strdup_printf ("%s --targetdir=schema-source --schema-file=%s/org.gtk.schemasourcecheck.gschema.xml", glib_compile_schemas, g_test_get_dir (G_TEST_DISTED)); cmdline = g_strdup_printf ("%s --targetdir=schema-source --schema-file=%s/org.gtk.schemasourcecheck.gschema.xml", glib_compile_schemas, g_test_get_dir (G_TEST_DIST));
g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL, &result, NULL)); g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL, &result, NULL));
g_assert (result == 0); g_assert (result == 0);
g_free (cmdline); g_free (cmdline);

View File

@ -43,7 +43,7 @@ pem_parser (const Reference *ref)
GError *error = NULL; GError *error = NULL;
/* Check PEM parsing in certificate, private key order. */ /* Check PEM parsing in certificate, private key order. */
g_file_get_contents (g_test_get_filename (G_TEST_DISTED, "cert-tests", "cert-key.pem", NULL), &pem, NULL, &error); g_file_get_contents (g_test_get_filename (G_TEST_DIST, "cert-tests", "cert-key.pem", NULL), &pem, NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (pem); g_assert (pem);
@ -70,7 +70,7 @@ pem_parser (const Reference *ref)
g_free (pem); g_free (pem);
/* Check PEM parsing in private key, certificate order */ /* Check PEM parsing in private key, certificate order */
g_file_get_contents (g_test_get_filename (G_TEST_DISTED, "cert-tests", "key-cert.pem", NULL), &pem, NULL, &error); g_file_get_contents (g_test_get_filename (G_TEST_DIST, "cert-tests", "key-cert.pem", NULL), &pem, NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (pem); g_assert (pem);
@ -92,7 +92,7 @@ pem_parser (const Reference *ref)
g_object_unref (cert); g_object_unref (cert);
/* Check certificate only PEM */ /* Check certificate only PEM */
g_file_get_contents (g_test_get_filename (G_TEST_DISTED, "cert-tests", "cert1.pem", NULL), &pem, NULL, &error); g_file_get_contents (g_test_get_filename (G_TEST_DIST, "cert-tests", "cert1.pem", NULL), &pem, NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (pem); g_assert (pem);
@ -113,7 +113,7 @@ pem_parser (const Reference *ref)
g_object_unref (cert); g_object_unref (cert);
/* Check error with private key only PEM */ /* Check error with private key only PEM */
g_file_get_contents (g_test_get_filename (G_TEST_DISTED, "cert-tests", "key.pem", NULL), &pem, NULL, &error); g_file_get_contents (g_test_get_filename (G_TEST_DIST, "cert-tests", "key.pem", NULL), &pem, NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (pem); g_assert (pem);
@ -132,7 +132,7 @@ from_file (const Reference *ref)
const gchar *parsed_key_pem = NULL; const gchar *parsed_key_pem = NULL;
GError *error = NULL; GError *error = NULL;
cert = g_tls_certificate_new_from_file (g_test_get_filename (G_TEST_DISTED, "cert-tests", "key-cert.pem", NULL), cert = g_tls_certificate_new_from_file (g_test_get_filename (G_TEST_DIST, "cert-tests", "key-cert.pem", NULL),
&error); &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (cert); g_assert (cert);
@ -158,8 +158,8 @@ from_files (const Reference *ref)
const gchar *parsed_key_pem = NULL; const gchar *parsed_key_pem = NULL;
GError *error = NULL; GError *error = NULL;
cert = g_tls_certificate_new_from_files (g_test_get_filename (G_TEST_DISTED, "cert-tests", "cert1.pem", NULL), cert = g_tls_certificate_new_from_files (g_test_get_filename (G_TEST_DIST, "cert-tests", "cert1.pem", NULL),
g_test_get_filename (G_TEST_DISTED, "cert-tests", "key.pem", NULL), g_test_get_filename (G_TEST_DIST, "cert-tests", "key.pem", NULL),
&error); &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (cert); g_assert (cert);
@ -177,16 +177,16 @@ from_files (const Reference *ref)
g_object_unref (cert); g_object_unref (cert);
/* Missing private key */ /* Missing private key */
cert = g_tls_certificate_new_from_files (g_test_get_filename (G_TEST_DISTED, "cert-tests", "cert1.pem", NULL), cert = g_tls_certificate_new_from_files (g_test_get_filename (G_TEST_DIST, "cert-tests", "cert1.pem", NULL),
g_test_get_filename (G_TEST_DISTED, "cert-tests", "cert2.pem", NULL), g_test_get_filename (G_TEST_DIST, "cert-tests", "cert2.pem", NULL),
&error); &error);
g_assert_error (error, G_TLS_ERROR, G_TLS_ERROR_BAD_CERTIFICATE); g_assert_error (error, G_TLS_ERROR, G_TLS_ERROR_BAD_CERTIFICATE);
g_clear_error (&error); g_clear_error (&error);
g_assert (cert == NULL); g_assert (cert == NULL);
/* Missing certificate */ /* Missing certificate */
cert = g_tls_certificate_new_from_files (g_test_get_filename (G_TEST_DISTED, "cert-tests", "key.pem", NULL), cert = g_tls_certificate_new_from_files (g_test_get_filename (G_TEST_DIST, "cert-tests", "key.pem", NULL),
g_test_get_filename (G_TEST_DISTED, "cert-tests", "key.pem", NULL), g_test_get_filename (G_TEST_DIST, "cert-tests", "key.pem", NULL),
&error); &error);
g_assert_error (error, G_TLS_ERROR, G_TLS_ERROR_BAD_CERTIFICATE); g_assert_error (error, G_TLS_ERROR, G_TLS_ERROR_BAD_CERTIFICATE);
g_clear_error (&error); g_clear_error (&error);
@ -195,8 +195,8 @@ from_files (const Reference *ref)
/* Using this method twice with a file containing both private key and /* Using this method twice with a file containing both private key and
* certificate as a way to inforce private key presence is a fair use * certificate as a way to inforce private key presence is a fair use
*/ */
cert = g_tls_certificate_new_from_files (g_test_get_filename (G_TEST_DISTED, "cert-tests", "key-cert.pem", NULL), cert = g_tls_certificate_new_from_files (g_test_get_filename (G_TEST_DIST, "cert-tests", "key-cert.pem", NULL),
g_test_get_filename (G_TEST_DISTED, "cert-tests", "key-cert.pem", NULL), g_test_get_filename (G_TEST_DIST, "cert-tests", "key-cert.pem", NULL),
&error); &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (cert); g_assert (cert);
@ -212,8 +212,8 @@ from_files_pkcs8 (const Reference *ref)
const gchar *parsed_key_pem = NULL; const gchar *parsed_key_pem = NULL;
GError *error = NULL; GError *error = NULL;
cert = g_tls_certificate_new_from_files (g_test_get_filename (G_TEST_DISTED, "cert-tests", "cert1.pem", NULL), cert = g_tls_certificate_new_from_files (g_test_get_filename (G_TEST_DIST, "cert-tests", "cert1.pem", NULL),
g_test_get_filename (G_TEST_DISTED, "cert-tests", "key8.pem", NULL), g_test_get_filename (G_TEST_DIST, "cert-tests", "key8.pem", NULL),
&error); &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (cert); g_assert (cert);
@ -238,7 +238,7 @@ list_from_file (const Reference *ref)
GError *error = NULL; GError *error = NULL;
int i; int i;
list = g_tls_certificate_list_new_from_file (g_test_get_filename (G_TEST_DISTED, "cert-tests", "cert-list.pem", NULL), list = g_tls_certificate_list_new_from_file (g_test_get_filename (G_TEST_DIST, "cert-tests", "cert-list.pem", NULL),
&error); &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert_cmpint (g_list_length (list), ==, 3); g_assert_cmpint (g_list_length (list), ==, 3);
@ -259,7 +259,7 @@ list_from_file (const Reference *ref)
g_list_free_full (list, g_object_unref); g_list_free_full (list, g_object_unref);
/* Empty list is not an error */ /* Empty list is not an error */
list = g_tls_certificate_list_new_from_file (g_test_get_filename (G_TEST_DISTED, "cert-tests", "nothing.pem", NULL), list = g_tls_certificate_list_new_from_file (g_test_get_filename (G_TEST_DIST, "cert-tests", "nothing.pem", NULL),
&error); &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert_cmpint (g_list_length (list), ==, 0); g_assert_cmpint (g_list_length (list), ==, 0);
@ -279,27 +279,27 @@ main (int argc,
_g_test_tls_backend_get_type (); _g_test_tls_backend_get_type ();
/* Load reference PEM */ /* Load reference PEM */
path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert1.pem", NULL); path = g_test_build_filename (G_TEST_DIST, "cert-tests", "cert1.pem", NULL);
g_file_get_contents (path, &ref.cert_pems[0], NULL, &error); g_file_get_contents (path, &ref.cert_pems[0], NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (ref.cert_pems[0]); g_assert (ref.cert_pems[0]);
g_free (path); g_free (path);
path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert2.pem", NULL); path = g_test_build_filename (G_TEST_DIST, "cert-tests", "cert2.pem", NULL);
g_file_get_contents (path, &ref.cert_pems[1], NULL, &error); g_file_get_contents (path, &ref.cert_pems[1], NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (ref.cert_pems[1]); g_assert (ref.cert_pems[1]);
g_free (path); g_free (path);
path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert3.pem", NULL); path = g_test_build_filename (G_TEST_DIST, "cert-tests", "cert3.pem", NULL);
g_file_get_contents (path, &ref.cert_pems[2], NULL, &error); g_file_get_contents (path, &ref.cert_pems[2], NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (ref.cert_pems[2]); g_assert (ref.cert_pems[2]);
g_free (path); g_free (path);
path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "key.pem", NULL); path = g_test_build_filename (G_TEST_DIST, "cert-tests", "key.pem", NULL);
g_file_get_contents (path, &ref.key_pem, NULL, &error); g_file_get_contents (path, &ref.key_pem, NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (ref.key_pem); g_assert (ref.key_pem);
g_free (path); g_free (path);
path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "key8.pem", NULL); path = g_test_build_filename (G_TEST_DIST, "cert-tests", "key8.pem", NULL);
g_file_get_contents (path, &ref.key8_pem, NULL, &error); g_file_get_contents (path, &ref.key8_pem, NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (ref.key8_pem); g_assert (ref.key8_pem);

View File

@ -2918,7 +2918,7 @@ g_test_build_filename_va (GTestFileType file_type,
const gchar *pathv[16]; const gchar *pathv[16];
gint num_path_segments; gint num_path_segments;
if (file_type == G_TEST_DISTED) if (file_type == G_TEST_DIST)
pathv[0] = test_disted_files_dir; pathv[0] = test_disted_files_dir;
else if (file_type == G_TEST_BUILT) else if (file_type == G_TEST_BUILT)
pathv[0] = test_built_files_dir; pathv[0] = test_built_files_dir;
@ -2941,7 +2941,7 @@ g_test_build_filename_va (GTestFileType file_type,
/** /**
* g_test_build_filename: * g_test_build_filename:
* @file_type: the type of file (built vs. disted) * @file_type: the type of file (built vs. distributed)
* @first_path: the first segment of the pathname * @first_path: the first segment of the pathname
* ...: NULL terminated additional path segments * ...: NULL terminated additional path segments
* *
@ -2951,8 +2951,8 @@ g_test_build_filename_va (GTestFileType file_type,
* that the first argument has been replaced with a #GTestFileType * that the first argument has been replaced with a #GTestFileType
* argument. * argument.
* *
* The data file should either have been disted with the module * The data file should either have been distributed with the module
* containing the test (%G_TEST_DISTED) or built as part of the build * containing the test (%G_TEST_DIST) or built as part of the build
* system of that module (%G_TEST_BUILT). * system of that module (%G_TEST_BUILT).
* *
* In order for this function to work in srcdir != builddir situations, * In order for this function to work in srcdir != builddir situations,
@ -2974,12 +2974,26 @@ g_test_build_filename_va (GTestFileType file_type,
**/ **/
/** /**
* GTestFileType: * GTestFileType:
* @G_TEST_DISTED: a file that was included in the distribution tarball * @G_TEST_DIST: a file that was included in the distribution tarball
* @G_TEST_BUILT: a file that was built on the compiling machine * @G_TEST_BUILT: a file that was built on the compiling machine
* *
* The type of file to return the filename for, when used with * The type of file to return the filename for, when used with
* g_test_build_filename(). * g_test_build_filename().
* *
* These two options correspond rather directly to the 'dist' and
* 'built' terminology that automake uses and are explicitly used to
* distinguish between the 'srcdir' and 'builddir' being separate. All
* files in your project should either be dist (in the
* <literal>DIST_EXTRA</literal> or <literal>dist_schema_DATA</literal>
* sense, in which case they will always be in the srcdir) or built (in
* the <literal>BUILT_SOURCES</literal> sense, in which case they will
* always be in the builddir).
*
* Note: as a general rule of automake, files that are generated only as
* part of the build-from-git process (but then are distributed with the
* tarball) always go in srcdir (even if doing a srcdir != builddir
* build from git) and are considered as distributed files.
*
* Since: 2.38 * Since: 2.38
**/ **/
gchar * gchar *
@ -3001,7 +3015,7 @@ g_test_build_filename (GTestFileType file_type,
/** /**
* g_test_get_dir: * g_test_get_dir:
* @file_type: the type of file (built vs. disted) * @file_type: the type of file (built vs. distributed)
* *
* Gets the pathname of the directory containing test files of the type * Gets the pathname of the directory containing test files of the type
* specified by @file_type. * specified by @file_type.
@ -3018,7 +3032,7 @@ g_test_get_dir (GTestFileType file_type)
{ {
g_assert (g_test_initialized ()); g_assert (g_test_initialized ());
if (file_type == G_TEST_DISTED) if (file_type == G_TEST_DIST)
return test_disted_files_dir; return test_disted_files_dir;
else if (file_type == G_TEST_BUILT) else if (file_type == G_TEST_BUILT)
return test_built_files_dir; return test_built_files_dir;
@ -3028,7 +3042,7 @@ g_test_get_dir (GTestFileType file_type)
/** /**
* g_test_get_filename: * g_test_get_filename:
* @file_type: the type of file (built vs. disted) * @file_type: the type of file (built vs. distributed)
* @first_path: the first segment of the pathname * @first_path: the first segment of the pathname
* ...: NULL terminated additional path segments * ...: NULL terminated additional path segments
* *

View File

@ -374,7 +374,7 @@ void g_test_assert_expected_messages_internal (const char *domain,
typedef enum typedef enum
{ {
G_TEST_DISTED, G_TEST_DIST,
G_TEST_BUILT G_TEST_BUILT
} GTestFileType; } GTestFileType;

View File

@ -278,14 +278,14 @@ main (int argc, char *argv[])
} }
error = NULL; error = NULL;
path = g_test_build_filename (G_TEST_DISTED, "bookmarks", NULL); path = g_test_build_filename (G_TEST_DIST, "bookmarks", NULL);
dir = g_dir_open (path, 0, &error); dir = g_dir_open (path, 0, &error);
g_free (path); g_free (path);
g_assert_no_error (error); g_assert_no_error (error);
while ((name = g_dir_read_name (dir)) != NULL) while ((name = g_dir_read_name (dir)) != NULL)
{ {
path = g_strdup_printf ("/bookmarks/parse/%s", name); path = g_strdup_printf ("/bookmarks/parse/%s", name);
g_test_add_data_func_full (path, g_test_build_filename (G_TEST_DISTED, "bookmarks", name, NULL), g_test_add_data_func_full (path, g_test_build_filename (G_TEST_DIST, "bookmarks", name, NULL),
test_file, g_free); test_file, g_free);
g_free (path); g_free (path);
} }

View File

@ -1340,7 +1340,7 @@ test_load_fail (void)
file = g_key_file_new (); file = g_key_file_new ();
error = NULL; error = NULL;
g_assert (!g_key_file_load_from_file (file, g_test_get_filename (G_TEST_DISTED, "keyfile.c", NULL), 0, &error)); g_assert (!g_key_file_load_from_file (file, g_test_get_filename (G_TEST_DIST, "keyfile.c", NULL), 0, &error));
g_assert_error (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE); g_assert_error (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE);
g_clear_error (&error); g_clear_error (&error);
g_assert (!g_key_file_load_from_file (file, "/nosuchfile", 0, &error)); g_assert (!g_key_file_load_from_file (file, "/nosuchfile", 0, &error));
@ -1407,7 +1407,7 @@ test_page_boundary (void)
file = g_key_file_new (); file = g_key_file_new ();
error = NULL; error = NULL;
g_key_file_load_from_file (file, g_test_get_filename (G_TEST_DISTED, "pages.ini", NULL), G_KEY_FILE_NONE, &error); g_key_file_load_from_file (file, g_test_get_filename (G_TEST_DIST, "pages.ini", NULL), G_KEY_FILE_NONE, &error);
g_assert_no_error (error); g_assert_no_error (error);
for (i = FIRST_KEY; i <= LAST_KEY; i++) for (i = FIRST_KEY; i <= LAST_KEY; i++)
@ -1572,7 +1572,7 @@ main (int argc, char *argv[])
g_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
g_setenv ("XDG_DATA_HOME", g_test_get_dir (G_TEST_DISTED), TRUE); g_setenv ("XDG_DATA_HOME", g_test_get_dir (G_TEST_DIST), TRUE);
#endif #endif
g_test_bug_base ("http://bugzilla.gnome.org/"); g_test_bug_base ("http://bugzilla.gnome.org/");

View File

@ -18,7 +18,7 @@ test_basic (void)
GError *error; GError *error;
error = NULL; error = NULL;
file = g_mapped_file_new (g_test_get_filename (G_TEST_DISTED, "empty", NULL), FALSE, &error); file = g_mapped_file_new (g_test_get_filename (G_TEST_DIST, "empty", NULL), FALSE, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_mapped_file_ref (file); g_mapped_file_ref (file);
@ -34,7 +34,7 @@ test_empty (void)
GError *error; GError *error;
error = NULL; error = NULL;
file = g_mapped_file_new (g_test_get_filename (G_TEST_DISTED, "empty", NULL), FALSE, &error); file = g_mapped_file_new (g_test_get_filename (G_TEST_DIST, "empty", NULL), FALSE, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (g_mapped_file_get_contents (file) == NULL); g_assert (g_mapped_file_get_contents (file) == NULL);
@ -83,7 +83,7 @@ test_writable (void)
tmp_copy_path = g_build_filename (g_get_user_runtime_dir (), "glib-test-4096-random-bytes", NULL); tmp_copy_path = g_build_filename (g_get_user_runtime_dir (), "glib-test-4096-random-bytes", NULL);
g_file_get_contents (g_test_get_filename (G_TEST_DISTED, "4096-random-bytes", NULL), &contents, &len, &error); g_file_get_contents (g_test_get_filename (G_TEST_DIST, "4096-random-bytes", NULL), &contents, &len, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_file_set_contents (tmp_copy_path, contents, len, &error); g_file_set_contents (tmp_copy_path, contents, len, &error);
g_assert_no_error (error); g_assert_no_error (error);
@ -127,7 +127,7 @@ test_writable_fd (void)
tmp_copy_path = g_build_filename (g_get_user_runtime_dir (), "glib-test-4096-random-bytes", NULL); tmp_copy_path = g_build_filename (g_get_user_runtime_dir (), "glib-test-4096-random-bytes", NULL);
g_file_get_contents (g_test_get_filename (G_TEST_DISTED, "4096-random-bytes", NULL), &contents, &len, &error); g_file_get_contents (g_test_get_filename (G_TEST_DIST, "4096-random-bytes", NULL), &contents, &len, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_file_set_contents (tmp_copy_path, contents, len, &error); g_file_set_contents (tmp_copy_path, contents, len, &error);
g_assert_no_error (error); g_assert_no_error (error);
@ -170,7 +170,7 @@ test_gbytes (void)
GError *error; GError *error;
error = NULL; error = NULL;
file = g_mapped_file_new (g_test_get_filename (G_TEST_DISTED, "empty", NULL), FALSE, &error); file = g_mapped_file_new (g_test_get_filename (G_TEST_DIST, "empty", NULL), FALSE, &error);
g_assert_no_error (error); g_assert_no_error (error);
bytes = g_mapped_file_get_bytes (file); bytes = g_mapped_file_get_bytes (file);

View File

@ -292,7 +292,7 @@ main (int argc, char *argv[])
} }
error = NULL; error = NULL;
path = g_test_build_filename (G_TEST_DISTED, "markups", NULL); path = g_test_build_filename (G_TEST_DIST, "markups", NULL);
dir = g_dir_open (path, 0, &error); dir = g_dir_open (path, 0, &error);
g_free (path); g_free (path);
g_assert_no_error (error); g_assert_no_error (error);
@ -302,7 +302,7 @@ main (int argc, char *argv[])
continue; continue;
path = g_strdup_printf ("/markup/parse/%s", name); path = g_strdup_printf ("/markup/parse/%s", name);
g_test_add_data_func_full (path, g_test_build_filename (G_TEST_DISTED, "markups", name, NULL), g_test_add_data_func_full (path, g_test_build_filename (G_TEST_DIST, "markups", name, NULL),
test_parse, g_free); test_parse, g_free);
g_free (path); g_free (path);
} }