[glib] Improve test coverage for filter streams
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Improve test coverage for filter streams
- Date: Sun, 19 Aug 2012 06:27:46 +0000 (UTC)
commit beea8c5c847a7bf46ae77d834ed7cc3fb6822c5c
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Aug 19 02:25:21 2012 -0400
Improve test coverage for filter streams
gio/tests/filter-streams.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/gio/tests/filter-streams.c b/gio/tests/filter-streams.c
index 050a4ea..6877a21 100644
--- a/gio/tests/filter-streams.c
+++ b/gio/tests/filter-streams.c
@@ -11,13 +11,17 @@
* Author: Ryan Lortie <desrt desrt ca>
*/
+#include <string.h>
#include <glib/glib.h>
#include <gio/gio.h>
static void
test_input_filter (void)
{
- GInputStream *base, *f1, *f2;
+ GInputStream *base, *f1, *f2, *s;
+ gboolean close_base;
+ gchar buf[1024];
+ GError *error = NULL;
g_test_bug ("568394");
base = g_memory_input_stream_new_from_data ("abcdefghijk", -1, NULL);
@@ -33,11 +37,27 @@ test_input_filter (void)
g_assert (!g_input_stream_is_closed (f1));
g_assert (!g_input_stream_is_closed (f2));
+ g_object_get (f1,
+ "close-base-stream", &close_base,
+ "base-stream", &s,
+ NULL);
+ g_assert (!close_base);
+ g_assert (s == base);
+ g_object_unref (s);
+
g_object_unref (f1);
g_assert (!g_input_stream_is_closed (base));
g_assert (!g_input_stream_is_closed (f2));
+ g_input_stream_skip (f2, 3, NULL, &error);
+ g_assert_no_error (error);
+
+ memset (buf, 0, 1024);
+ g_input_stream_read_all (f2, buf, 1024, NULL, NULL, &error);
+ g_assert_no_error (error);
+ g_assert_cmpstr (buf, ==, "defghijk");
+
g_object_unref (f2);
g_assert (g_input_stream_is_closed (base));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]