pidgin: 80983063: * Use our assert_string_equal() macro in...

markdoliner at pidgin.im markdoliner at pidgin.im
Thu Jul 2 04:30:32 EDT 2009


-----------------------------------------------------------------
Revision: 809830638cc6885e09bf33ce332d547806de0762
Ancestor: 8f641ab3b243269d548ee312fe69394de9c7633e
Author: markdoliner at pidgin.im
Date: 2009-07-02T08:24:51
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/809830638cc6885e09bf33ce332d547806de0762

Modified files:
        libpurple/tests/test_util.c

ChangeLog: 

* Use our assert_string_equal() macro instead of fail_unless(strcmp(), NULL)
* Fix the test_markup_html_to_xhtml test by looking for <a href=""> instead of <a href=''>  I guess we changed that function to use double quotes instead of single quotes?
* Add a test_mime_decode_field function (with only one test)

-------------- next part --------------
============================================================
--- libpurple/tests/test_util.c	9b590fba5afb2938a06ece0d2a9c69dda0c787b4
+++ libpurple/tests/test_util.c	e7d0b170b4990a5a4445a817d69f0aab55dde056
@@ -14,7 +14,7 @@ START_TEST(test_util_base16_decode)
 	gsize sz = 0;
 	guchar *out = purple_base16_decode("21646c726f77202c6f6c6c656800", &sz);
 	fail_unless(sz == 14, NULL);
-	fail_unless(strcmp("!dlrow ,olleh", (const char *)out) == 0, NULL);
+	assert_string_equal("!dlrow ,olleh", (const char *)out);
 	g_free(out);
 }
 END_TEST
@@ -30,7 +30,7 @@ START_TEST(test_util_base64_decode)
 	gsize sz;
 	guchar *out = purple_base64_decode("b3d0LXl0cm9mAA==", &sz);
 	fail_unless(sz == 10, NULL);
-	fail_unless(strcmp("owt-ytrof", (const char *)out) == 0, NULL);
+	assert_string_equal("owt-ytrof", (const char *)out);
 	g_free(out);
 }
 END_TEST
@@ -94,13 +94,21 @@ START_TEST(test_markup_html_to_xhtml)
 	gchar *xhtml = NULL;
 	gchar *plaintext = NULL;
 	purple_markup_html_to_xhtml("<a>", &xhtml, &plaintext);
-	fail_unless(strcmp("<a href=''></a>", xhtml) == 0, NULL);
+	assert_string_equal("<a href=\"\"></a>", xhtml);
 	g_free(xhtml);
-	fail_unless(strcmp("", plaintext) == 0, NULL);
+	assert_string_equal("", plaintext);
 	g_free(plaintext);
 }
 END_TEST
 
+START_TEST(test_mime_decode_field)
+{
+	gchar *result = purple_mime_decode_field("=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?=");
+	assert_string_equal("Keld J?rn Simonsen", result);
+	g_free(result);
+}
+END_TEST
+
 Suite *
 util_suite(void)
 {
@@ -137,5 +145,9 @@ util_suite(void)
 	tcase_add_test(tc, test_markup_html_to_xhtml);
 	suite_add_tcase(s, tc);
 
+	tc = tcase_create("MIME");
+	tcase_add_test(tc, test_mime_decode_field);
+	suite_add_tcase(s, tc);
+
 	return s;
 }


More information about the Commits mailing list