[tracker/tracker-0.6] Fix gtester report
- From: Ivan Frade <ifrade src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker/tracker-0.6] Fix gtester report
- Date: Tue, 21 Apr 2009 10:18:54 -0400 (EDT)
commit d949ac06c83f89ad1a428cb31451d7e1e4c09cdd
Author: Ivan Frade <ivan frade nokia com>
Date: Tue Apr 21 17:10:18 2009 +0300
Fix gtester report
tracker-dbus-test's output was non-utf8 text, and that was
breaking the gtester XML parsing. Now tracker-dbus-test catch and verify
the output, without printing it.
---
tests/libtracker-common/tracker-dbus-test.c | 36 ++++++++++++++++++++------
1 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/tests/libtracker-common/tracker-dbus-test.c b/tests/libtracker-common/tracker-dbus-test.c
index f8589bc..7bf9dda 100644
--- a/tests/libtracker-common/tracker-dbus-test.c
+++ b/tests/libtracker-common/tracker-dbus-test.c
@@ -40,14 +40,23 @@ slist_to_strv (gboolean utf8)
}
g_assert_cmpint (g_slist_length (input), ==, strings);
- input_as_strv = tracker_dbus_slist_to_strv (input);
-
- g_assert_cmpint (g_strv_length (input_as_strv), ==, (utf8 ? strings : 0));
+ if (utf8) {
+ input_as_strv = tracker_dbus_slist_to_strv (input);
+
+ g_assert_cmpint (g_strv_length (input_as_strv), ==, (utf8 ? strings : 0));
+ g_strfreev (input_as_strv);
+ } else {
+ if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
+ input_as_strv = tracker_dbus_slist_to_strv (input);
+ }
+ /* Error message:
+ * Could not add string:'/invalid/file/\xe4\xf6\xe590808.' to GStrv, invalid UTF-8
+ */
+ g_test_trap_assert_stderr ("*Could not add string:*");
+ }
g_slist_foreach (input, (GFunc) g_free, NULL);
g_slist_free (input);
-
- g_strfreev (input_as_strv);
}
static void
@@ -81,13 +90,22 @@ async_queue_to_strv (gboolean utf8)
}
g_assert_cmpint (g_queue_get_length (queue), ==, strings);
- queue_as_strv = tracker_dbus_queue_str_to_strv (queue, g_queue_get_length (queue));
-
- g_assert_cmpint (g_strv_length (queue_as_strv), ==, (utf8 ? strings : 0));
+ if (utf8) {
+ queue_as_strv = tracker_dbus_queue_str_to_strv (queue, g_queue_get_length (queue));
+ g_assert_cmpint (g_strv_length (queue_as_strv), ==, strings);
+ g_strfreev (queue_as_strv);
+ } else {
+ if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
+ queue_as_strv = tracker_dbus_queue_str_to_strv (queue, g_queue_get_length (queue));
+ }
+ /* Error message:
+ * Could not add string:'/invalid/file/\xe4\xf6\xe590808.' to GStrv, invalid UTF-8
+ */
+ g_test_trap_assert_stderr ("*Could not add string:*");
+ }
/* Queue empty by tracker_dbus_async_queue_to_strv */
g_queue_free (queue);
- g_strfreev (queue_as_strv);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]