gplugin/gplugin

fix tests on Windows

2022-01-24, ivanhoe
1378438e0be3
Parents 95faabe7d05f
Children 947b65f1ef43
fix tests on Windows
--- a/gplugin/tests/meson.build Sat Jan 15 20:05:50 2022 -0600
+++ b/gplugin/tests/meson.build Mon Jan 24 20:35:04 2022 -0600
@@ -78,6 +78,9 @@
#######################################
# Dynamic Type
#######################################
+# dynamic-type-provider and dynamic-type-user libs are not built on Windows
+# so no need to test them there either
+if host_machine.system() != 'windows'
e = executable('test-dynamic-type', 'test-dynamic-type.c',
c_args : [
'-DTEST_DYNAMIC_DIR="@0@/dynamic-type/"'.format(
@@ -85,6 +88,7 @@
],
dependencies : [gplugin_dep, GLIB, GOBJECT])
test('Dynamic Type', e)
+endif
#######################################
# ID Collision
--- a/gplugin/tests/test-option-group.c Sat Jan 15 20:05:50 2022 -0600
+++ b/gplugin/tests/test-option-group.c Mon Jan 24 20:35:04 2022 -0600
@@ -106,7 +106,7 @@
gchar *args = "test-option-group,-p,foo";
expected = test_gplugin_manager_default_paths();
- expected = g_list_prepend(expected, g_strdup("foo/"));
+ expected = g_list_prepend(expected, g_strdup_printf("foo%s", G_DIR_SEPARATOR_S));
test_gplugin_option_group_paths(args, expected);
}
@@ -118,9 +118,9 @@
gchar *args = "test-option-group,-p,foo,-p,bar,-p,baz";
expected = test_gplugin_manager_default_paths();
- expected = g_list_prepend(expected, g_strdup("foo/"));
- expected = g_list_prepend(expected, g_strdup("bar/"));
- expected = g_list_prepend(expected, g_strdup("baz/"));
+ expected = g_list_prepend(expected, g_strdup_printf("foo%s", G_DIR_SEPARATOR_S));
+ expected = g_list_prepend(expected, g_strdup_printf("bar%s", G_DIR_SEPARATOR_S));
+ expected = g_list_prepend(expected, g_strdup_printf("baz%s", G_DIR_SEPARATOR_S));
test_gplugin_option_group_paths(args, expected);
}
@@ -147,7 +147,7 @@
GList *expected = NULL;
gchar *args = "test-option-group,-D,-p,foo";
- expected = g_list_prepend(expected, g_strdup("foo/"));
+ expected = g_list_prepend(expected, g_strdup_printf("foo%s", G_DIR_SEPARATOR_S));
test_gplugin_option_group_paths(args, expected);
}
@@ -158,9 +158,9 @@
GList *expected = NULL;
gchar *args = "test-option-group,-D,-p,foo,-p,bar,-p,baz";
- expected = g_list_prepend(expected, g_strdup("foo/"));
- expected = g_list_prepend(expected, g_strdup("bar/"));
- expected = g_list_prepend(expected, g_strdup("baz/"));
+ expected = g_list_prepend(expected, g_strdup_printf("foo%s", G_DIR_SEPARATOR_S));
+ expected = g_list_prepend(expected, g_strdup_printf("bar%s", G_DIR_SEPARATOR_S));
+ expected = g_list_prepend(expected, g_strdup_printf("baz%s", G_DIR_SEPARATOR_S));
test_gplugin_option_group_paths(args, expected);
}
@@ -168,7 +168,7 @@
static void
test_gplugin_option_group_add_path_short(void)
{
- GList *expected = g_list_prepend(NULL, g_strdup("foo/"));
+ GList *expected = g_list_prepend(NULL, g_strdup_printf("foo%s", G_DIR_SEPARATOR_S));
gchar *args = "test-option-group,-D,-p,foo";
test_gplugin_option_group_paths(args, expected);
@@ -177,7 +177,7 @@
static void
test_gplugin_option_group_add_path_long(void)
{
- GList *expected = g_list_prepend(NULL, g_strdup("foo/"));
+ GList *expected = g_list_prepend(NULL, g_strdup_printf("foo%s", G_DIR_SEPARATOR_S));
gchar *args = "test-option-group,-D,--path,foo";
test_gplugin_option_group_paths(args, expected);
--- a/gplugin/tests/test-plugin-manager-paths.c Sat Jan 15 20:05:50 2022 -0600
+++ b/gplugin/tests/test-plugin-manager-paths.c Mon Jan 24 20:35:04 2022 -0600
@@ -123,16 +123,16 @@
test_path_count(manager, 0);
- gplugin_manager_append_path(manager, "/home/user1/.plugins");
+ gplugin_manager_append_path(manager, G_DIR_SEPARATOR_S "home" G_DIR_SEPARATOR_S "user1" G_DIR_SEPARATOR_S ".plugins");
test_path_count(manager, 1);
- gplugin_manager_append_path(manager, "/home/user2/.plugins/");
+ gplugin_manager_append_path(manager, G_DIR_SEPARATOR_S "home" G_DIR_SEPARATOR_S "user2" G_DIR_SEPARATOR_S ".plugins" G_DIR_SEPARATOR_S "");
test_path_count(manager, 2);
- gplugin_manager_remove_path(manager, "/home/user1/.plugins/");
+ gplugin_manager_remove_path(manager, G_DIR_SEPARATOR_S "home" G_DIR_SEPARATOR_S "user1" G_DIR_SEPARATOR_S ".plugins" G_DIR_SEPARATOR_S "");
test_path_count(manager, 1);
- gplugin_manager_remove_path(manager, "/home/user2/.plugins");
+ gplugin_manager_remove_path(manager, G_DIR_SEPARATOR_S "home" G_DIR_SEPARATOR_S "user2" G_DIR_SEPARATOR_S ".plugins");
test_path_count(manager, 0);
}
@@ -239,16 +239,20 @@
path_count = g_list_length(paths);
/* build contents of environment vars */
- pre_paths = g_strdup_printf(
- "%s%s%s",
- "/prefoo",
- G_SEARCHPATH_SEPARATOR_S,
- "/prebar/");
- post_paths = g_strdup_printf(
- "%s%s%s",
- "/postfoo",
- G_SEARCHPATH_SEPARATOR_S,
- "/postbar/");
+ pre_paths = g_strdup_printf("%s%s%s%s%s%s",
+ G_DIR_SEPARATOR_S,
+ "prefoo",
+ G_SEARCHPATH_SEPARATOR_S,
+ G_DIR_SEPARATOR_S,
+ "prebar",
+ G_DIR_SEPARATOR_S);
+ post_paths = g_strdup_printf("%s%s%s%s%s%s",
+ G_DIR_SEPARATOR_S,
+ "postfoo",
+ G_SEARCHPATH_SEPARATOR_S,
+ G_DIR_SEPARATOR_S,
+ "postbar",
+ G_DIR_SEPARATOR_S);
/* put /envfoo and /envbar as paths in an environment variable */
g_setenv(pre_env_var_name, pre_paths, TRUE);
@@ -268,16 +272,16 @@
path_pos = 0;
for(l = paths; l != NULL; l = l->next) {
path_pos += 1;
- if(g_strcmp0(l->data, "/prefoo/") == 0) {
+ if(g_strcmp0(l->data, G_DIR_SEPARATOR_S "prefoo" G_DIR_SEPARATOR_S) == 0) {
g_assert_cmpint(2, >=, path_pos);
found_paths += 1;
- } else if(g_strcmp0(l->data, "/prebar/") == 0) {
+ } else if(g_strcmp0(l->data, G_DIR_SEPARATOR_S "prebar" G_DIR_SEPARATOR_S) == 0) {
g_assert_cmpint(2, >=, path_pos);
found_paths += 1;
- } else if(g_strcmp0(l->data, "/postfoo/") == 0) {
+ } else if(g_strcmp0(l->data, G_DIR_SEPARATOR_S "postfoo" G_DIR_SEPARATOR_S) == 0) {
g_assert_cmpint(2, <, path_pos);
found_paths += 1;
- } else if(g_strcmp0(l->data, "/postbar/") == 0) {
+ } else if(g_strcmp0(l->data, G_DIR_SEPARATOR_S "postbar" G_DIR_SEPARATOR_S) == 0) {
g_assert_cmpint(2, <, path_pos);
found_paths += 1;
}