[libsoup] tests: fix a few bugs
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] tests: fix a few bugs
- Date: Tue, 4 Dec 2012 16:46:34 +0000 (UTC)
commit fb840471fd06dd52fbf9f656204561028682264c
Author: Dan Winship <danw gnome org>
Date: Tue Dec 4 11:44:02 2012 -0500
tests: fix a few bugs
Fix a few places where the test might crash rather than reporting an
error when something went wrong.
tests/continue-test.c | 2 +-
tests/header-parsing.c | 12 +++++++-----
2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/tests/continue-test.c b/tests/continue-test.c
index fa9ef80..7cc9f69 100644
--- a/tests/continue-test.c
+++ b/tests/continue-test.c
@@ -106,10 +106,10 @@ do_message (const char *path, gboolean long_body,
while ((expected_event = va_arg (ap, const char *))) {
if (!events) {
- actual_event = g_strdup ("");
debug_printf (1, " Expected '%s', got end of list\n",
expected_event);
errors++;
+ continue;
} else {
actual_event = events->data;
if (strcmp (expected_event, actual_event) != 0) {
diff --git a/tests/header-parsing.c b/tests/header-parsing.c
index e57d7d8..5b2950f 100644
--- a/tests/header-parsing.c
+++ b/tests/header-parsing.c
@@ -732,7 +732,7 @@ check_headers (Header *headers, SoupMessageHeaders *hdrs)
break;
}
value = soup_message_headers_get_list (hdrs, headers[i].name);
- if (strcmp (value, headers[i].value) != 0) {
+ if (!value || strcmp (value, headers[i].value) != 0) {
ok = FALSE;
break;
}
@@ -981,11 +981,12 @@ do_content_disposition_tests (void)
g_hash_table_destroy (params);
header = soup_message_headers_get_one (hdrs, "Content-Disposition");
- if (!strcmp (header, RFC5987_TEST_HEADER_ENCODED))
+ if (!g_strcmp0 (header, RFC5987_TEST_HEADER_ENCODED))
debug_printf (1, " encoded OK\n");
else {
debug_printf (1, " encoding FAILED!\n expected: %s\n got: %s\n",
- RFC5987_TEST_HEADER_ENCODED, header);
+ RFC5987_TEST_HEADER_ENCODED,
+ header ? header : "(none)");
errors++;
}
@@ -1117,11 +1118,12 @@ do_content_type_tests (void)
g_hash_table_destroy (params);
header = soup_message_headers_get_one (hdrs, "Content-Type");
- if (!strcmp (header, CONTENT_TYPE_TEST_HEADER))
+ if (!g_strcmp0 (header, CONTENT_TYPE_TEST_HEADER))
debug_printf (1, " encoded OK\n");
else {
debug_printf (1, " encoding FAILED!\n expected: %s\n got: %s\n",
- CONTENT_TYPE_TEST_HEADER, header);
+ CONTENT_TYPE_TEST_HEADER,
+ header ? header : "(none)");
errors++;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]