diff libpurple/tests/test_jabber_jutil.c @ 27674:e5fdfff98aa9

When GNU Libidn is available, use it for XMPP stringprep operations. I made configure fail if libidn is unavailable and force_deps is set because glib's UTF-8 strdown and casefold operations fail one of the tests I've updated (based on running the tests with libidn). Running without libidn will still work in almost every case because people use all-ASCII JabberIDs and I had to search a fair amount to find characters for which GLib failed. This shouldn't have a performance impact on top of Mark's optimizations for all-ASCII JIDs.
author Paul Aurich <paul@darkrain42.org>
date Fri, 17 Jul 2009 21:11:25 +0000
parents 090dc513552f
children 22c65c1090a8
line wrap: on
line diff
--- a/libpurple/tests/test_jabber_jutil.c	Fri Jul 17 02:19:31 2009 +0000
+++ b/libpurple/tests/test_jabber_jutil.c	Fri Jul 17 21:11:25 2009 +0000
@@ -44,6 +44,10 @@
 	longnode = g_strnfill(1023, 'a');
 	fail_unless(jabber_nodeprep_validate(longnode));
 	g_free(longnode);
+
+	longnode = g_strnfill(1024, 'a');
+	fail_if(jabber_nodeprep_validate(longnode));
+	g_free(longnode);
 }
 END_TEST
 
@@ -132,7 +136,19 @@
 	/* Ensure that jabber_id_new is properly lowercasing node and domains */
 	assert_jid_parts("paul", "darkrain42.org", "PaUL@darkrain42.org");
 	assert_jid_parts("paul", "darkrain42.org", "paul@DaRkRaIn42.org");
-	assert_jid_parts("ꙥ", "darkrain42.org", "Ꙥ@darkrain42.org");
+
+	/* These case-mapping tests culled from examining RFC3454 B.2 */
+
+	/* Cyrillic capital EF (U+0424) maps to lowercase EF (U+0444) */
+	assert_jid_parts("ф", "darkrain42.org", "Ф@darkrain42.org");
+	/*
+	 * These character (U+A664 and U+A665) are not mapped to anything in
+	 * RFC3454 B.2. This first test *fails* when not using IDN because glib's
+	 * case-folding/utf8_strdown improperly lowercases the character.
+	 */
+	assert_jid_parts("Ꙥ", "darkrain42.org", "Ꙥ@darkrain42.org");
+	assert_jid_parts("ꙥ", "darkrain42.org", "ꙥ@darkrain42.org");
+	/* U+04E9 to U+04E9 */
 	assert_jid_parts("paul", "өarkrain42.org", "paul@Өarkrain42.org");
 }
 END_TEST