mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-06-11 23:23:47 +02:00
Some final g_test_build_filename() porting
This should be the last users that need to be ported. For some of the oldschool non-gtester-ified tests, we call g_test_init() from main() because it is necessary in order to use g_test_build_filename().
This commit is contained in:
parent
d7b3e558cf
commit
e66abbe2ef
@ -13,7 +13,7 @@ main (int argc, char *argv[])
|
|||||||
g_assert_cmpint (pid_from_env, ==, getpid ());
|
g_assert_cmpint (pid_from_env, ==, getpid ());
|
||||||
|
|
||||||
envvar = g_getenv ("GIO_LAUNCHED_DESKTOP_FILE");
|
envvar = g_getenv ("GIO_LAUNCHED_DESKTOP_FILE");
|
||||||
g_assert_cmpstr (envvar, ==, SRCDIR "/appinfo-test.desktop");
|
g_assert_cmpstr (envvar, ==, g_test_get_filename (G_TEST_DIST, "appinfo-test.desktop", NULL));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,7 @@ test_extra_getters (void)
|
|||||||
gchar *s;
|
gchar *s;
|
||||||
gboolean b;
|
gboolean b;
|
||||||
|
|
||||||
appinfo = g_desktop_app_info_new_from_filename (SRCDIR "/appinfo-test.desktop");
|
appinfo = g_desktop_app_info_new_from_filename (g_test_get_filename (G_TEST_DIST, "appinfo-test.desktop", NULL));
|
||||||
g_assert (appinfo != NULL);
|
g_assert (appinfo != NULL);
|
||||||
|
|
||||||
g_assert (g_desktop_app_info_has_key (appinfo, "Terminal"));
|
g_assert (g_desktop_app_info_has_key (appinfo, "Terminal"));
|
||||||
|
@ -1309,7 +1309,7 @@ test_load (void)
|
|||||||
/* Uses the value of $XDG_DATA_HOME we set in main() */
|
/* Uses the value of $XDG_DATA_HOME we set in main() */
|
||||||
loaded = g_key_file_load_from_data_dirs (file, "keyfiletest.ini", NULL, 0, &error);
|
loaded = g_key_file_load_from_data_dirs (file, "keyfiletest.ini", NULL, 0, &error);
|
||||||
#else
|
#else
|
||||||
loaded = g_key_file_load_from_file (file, SRCDIR "/keyfiletest.ini", 0, &error);
|
loaded = g_key_file_load_from_file (file, g_test_get_filename (G_TEST_DIST, "keyfiletest.ini", NULL), 0, &error);
|
||||||
#endif
|
#endif
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (loaded);
|
g_assert (loaded);
|
||||||
|
@ -204,7 +204,7 @@ main (int argc,
|
|||||||
if (!g_file_test (echo_script_path, G_FILE_TEST_EXISTS))
|
if (!g_file_test (echo_script_path, G_FILE_TEST_EXISTS))
|
||||||
{
|
{
|
||||||
g_free (echo_script_path);
|
g_free (echo_script_path);
|
||||||
echo_script_path = g_build_filename (SRCDIR, "echo-script", NULL);
|
echo_script_path = g_test_build_filename (G_TEST_DIST, "echo-script", NULL);
|
||||||
}
|
}
|
||||||
g_free (dirname);
|
g_free (dirname);
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
#define BUFFER_SIZE 1024
|
#define BUFFER_SIZE 1024
|
||||||
|
|
||||||
static const gchar *datapath;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_small_writes (void)
|
test_small_writes (void)
|
||||||
{
|
{
|
||||||
@ -66,12 +64,9 @@ gint main (gint argc, gchar * argv[])
|
|||||||
const gchar encoding[] = "EUC-JP";
|
const gchar encoding[] = "EUC-JP";
|
||||||
GIOStatus status;
|
GIOStatus status;
|
||||||
|
|
||||||
if (g_getenv ("G_TEST_DATA"))
|
g_test_init (&argc, &argv, NULL);
|
||||||
datapath = g_getenv ("G_TEST_DATA");
|
|
||||||
else
|
|
||||||
datapath = SRCDIR;
|
|
||||||
|
|
||||||
filename = g_build_filename (datapath, "iochannel-test-infile", NULL);
|
filename = g_test_build_filename (G_TEST_DIST, "iochannel-test-infile", NULL);
|
||||||
|
|
||||||
setbuf (stdout, NULL); /* For debugging */
|
setbuf (stdout, NULL); /* For debugging */
|
||||||
|
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static const gchar *datapath;
|
|
||||||
|
|
||||||
gchar* global_state;
|
gchar* global_state;
|
||||||
|
|
||||||
G_MODULE_EXPORT void g_clash_func (void);
|
G_MODULE_EXPORT void g_clash_func (void);
|
||||||
@ -75,24 +73,21 @@ test_states (const gchar *global, const gchar *gplugin_a,
|
|||||||
static SimpleFunc plugin_clash_func = NULL;
|
static SimpleFunc plugin_clash_func = NULL;
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int arg,
|
main (int argc,
|
||||||
char *argv[])
|
char **argv)
|
||||||
{
|
{
|
||||||
GModule *module_self, *module_a, *module_b;
|
GModule *module_self, *module_a, *module_b;
|
||||||
gchar *plugin_a, *plugin_b;
|
gchar *plugin_a, *plugin_b;
|
||||||
SimpleFunc f_a, f_b, f_self;
|
SimpleFunc f_a, f_b, f_self;
|
||||||
GModuleFunc gmod_f;
|
GModuleFunc gmod_f;
|
||||||
|
|
||||||
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
if (!g_module_supported ())
|
if (!g_module_supported ())
|
||||||
g_error ("dynamic modules not supported");
|
g_error ("dynamic modules not supported");
|
||||||
|
|
||||||
if (g_getenv ("G_TEST_DATA"))
|
plugin_a = g_test_build_filename (G_TEST_BUILT, "libmoduletestplugin_a", NULL);
|
||||||
datapath = g_getenv ("G_TEST_DATA");
|
plugin_b = g_test_build_filename (G_TEST_BUILT, "libmoduletestplugin_b", NULL);
|
||||||
else
|
|
||||||
datapath = ".";
|
|
||||||
|
|
||||||
plugin_a = g_build_filename (datapath, "libmoduletestplugin_a", NULL);
|
|
||||||
plugin_b = g_build_filename (datapath, "libmoduletestplugin_b", NULL);
|
|
||||||
|
|
||||||
/* module handles */
|
/* module handles */
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ int main (int argc, char **argv)
|
|||||||
FILE *infile;
|
FILE *infile;
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
char **strings;
|
char **strings;
|
||||||
const char *srcdir;
|
|
||||||
char *filename;
|
char *filename;
|
||||||
const char *locale;
|
const char *locale;
|
||||||
const char *test;
|
const char *test;
|
||||||
@ -21,12 +20,9 @@ int main (int argc, char **argv)
|
|||||||
char *current_locale = setlocale (LC_CTYPE, NULL);
|
char *current_locale = setlocale (LC_CTYPE, NULL);
|
||||||
gint result = 0;
|
gint result = 0;
|
||||||
|
|
||||||
if (g_getenv ("G_TEST_DATA"))
|
g_test_init (&argc, &argv, NULL);
|
||||||
srcdir = g_getenv ("G_TEST_DATA");
|
|
||||||
else
|
|
||||||
srcdir = SRCDIR;
|
|
||||||
|
|
||||||
filename = g_strconcat (srcdir, G_DIR_SEPARATOR_S, "casemap.txt", NULL);
|
filename = g_test_build_filename (G_TEST_DIST, "casemap.txt", NULL);
|
||||||
|
|
||||||
infile = fopen (filename, "r");
|
infile = fopen (filename, "r");
|
||||||
if (!infile)
|
if (!infile)
|
||||||
@ -96,7 +92,7 @@ int main (int argc, char **argv)
|
|||||||
fclose (infile);
|
fclose (infile);
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
filename = g_strconcat (srcdir, G_DIR_SEPARATOR_S, "casefold.txt", NULL);
|
filename = g_test_build_filename (G_TEST_DIST, "casefold.txt", NULL);
|
||||||
|
|
||||||
infile = fopen (filename, "r");
|
infile = fopen (filename, "r");
|
||||||
if (!infile)
|
if (!infile)
|
||||||
|
@ -308,7 +308,6 @@ process (gint line,
|
|||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
const gchar *srcdir;
|
|
||||||
gchar *testfile;
|
gchar *testfile;
|
||||||
gchar *contents;
|
gchar *contents;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@ -321,12 +320,9 @@ main (int argc, char **argv)
|
|||||||
GArray *ucs4;
|
GArray *ucs4;
|
||||||
Status status = VALID; /* Quiet GCC */
|
Status status = VALID; /* Quiet GCC */
|
||||||
|
|
||||||
if (g_getenv ("G_TEST_DATA"))
|
g_test_init (&argc, &argv, NULL);
|
||||||
srcdir = g_getenv ("G_TEST_DATA");
|
|
||||||
else
|
|
||||||
srcdir = SRCDIR;
|
|
||||||
|
|
||||||
testfile = g_strconcat (srcdir, G_DIR_SEPARATOR_S "utf8.txt", NULL);
|
testfile = g_test_build_filename (G_TEST_DIST, "utf8.txt", NULL);
|
||||||
|
|
||||||
g_file_get_contents (testfile, &contents, NULL, &error);
|
g_file_get_contents (testfile, &contents, NULL, &error);
|
||||||
if (error)
|
if (error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user