test/utils: Add vararg variant of meta_test_client_do()

To be used by wrapper that puts the error in a g_error().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2237>
This commit is contained in:
Jonas Ådahl 2022-01-14 22:06:18 +01:00 committed by Marge Bot
parent 5e3f89e342
commit 68fd9bf534
2 changed files with 23 additions and 8 deletions

View File

@ -213,15 +213,12 @@ test_client_line_read (GObject *source,
}
gboolean
meta_test_client_do (MetaTestClient *client,
GError **error,
...)
meta_test_client_dov (MetaTestClient *client,
GError **error,
va_list vap)
{
GString *command = g_string_new (NULL);
char *line = NULL;
va_list vap;
va_start (vap, error);
while (TRUE)
{
@ -239,8 +236,6 @@ meta_test_client_do (MetaTestClient *client,
g_free (quoted);
}
va_end (vap);
g_string_append_c (command, '\n');
if (!g_data_output_stream_put_string (client->in, command->str,
@ -287,6 +282,21 @@ meta_test_client_do (MetaTestClient *client,
return *error == NULL;
}
gboolean
meta_test_client_do (MetaTestClient *client,
GError **error,
...)
{
va_list vap;
gboolean retval;
va_start (vap, error);
retval = meta_test_client_dov (client, error, vap);
va_end (vap);
return retval;
}
gboolean
meta_test_client_wait (MetaTestClient *client,
GError **error)

View File

@ -73,6 +73,11 @@ META_EXPORT
gboolean meta_test_client_wait (MetaTestClient *client,
GError **error);
META_EXPORT
gboolean meta_test_client_dov (MetaTestClient *client,
GError **error,
va_list vap);
META_EXPORT
gboolean meta_test_client_do (MetaTestClient *client,
GError **error,