[glib] Improve test coverage for pollable streams
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Improve test coverage for pollable streams
- Date: Sun, 19 Aug 2012 06:27:36 +0000 (UTC)
commit 3afec2b87282b25233add6bcdfb9af4657f40ddd
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Aug 19 02:24:44 2012 -0400
Improve test coverage for pollable streams
gio/tests/pollable.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/gio/tests/pollable.c b/gio/tests/pollable.c
index fe12d32..e30abf8 100644
--- a/gio/tests/pollable.c
+++ b/gio/tests/pollable.c
@@ -166,6 +166,34 @@ test_pollable_unix (void)
g_object_unref (out);
close (fd);
}
+
+static void
+test_pollable_converter (void)
+{
+ GConverter *converter;
+ GError *error = NULL;
+ GInputStream *ibase;
+ int pipefds[2], status;
+
+ status = pipe (pipefds);
+ g_assert_cmpint (status, ==, 0);
+
+ ibase = G_INPUT_STREAM (g_unix_input_stream_new (pipefds[0], TRUE));
+ converter = G_CONVERTER (g_charset_converter_new ("UTF-8", "UTF-8", &error));
+ g_assert_no_error (error);
+
+ in = G_POLLABLE_INPUT_STREAM (g_converter_input_stream_new (ibase, converter));
+ g_object_unref (converter);
+ g_object_unref (ibase);
+
+ out = g_unix_output_stream_new (pipefds[1], TRUE);
+
+ test_streams ();
+
+ g_object_unref (in);
+ g_object_unref (out);
+}
+
#endif
static void
@@ -250,6 +278,7 @@ main (int argc,
#ifdef G_OS_UNIX
g_test_add_func ("/pollable/unix", test_pollable_unix);
+ g_test_add_func ("/pollable/converter", test_pollable_converter);
#endif
g_test_add_func ("/pollable/socket", test_pollable_socket);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]