Fri, 17 Jul 2009 21:11:25 +0000
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.
|
15950
0f01bb61c5d3
Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15435
diff
changeset
|
1 | #include <string.h> |
|
0f01bb61c5d3
Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15435
diff
changeset
|
2 | |
| 15155 | 3 | #include "tests.h" |
|
15953
dfb69139ddf9
Update #includes to match changes in jabber
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15950
diff
changeset
|
4 | #include "../account.h" |
|
dfb69139ddf9
Update #includes to match changes in jabber
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15950
diff
changeset
|
5 | #include "../conversation.h" |
|
dfb69139ddf9
Update #includes to match changes in jabber
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15950
diff
changeset
|
6 | #include "../xmlnode.h" |
| 15155 | 7 | #include "../protocols/jabber/jutil.h" |
| 8 | ||
| 9 | START_TEST(test_get_resource) | |
| 10 | { | |
| 11 | assert_string_equal_free("baz", jabber_get_resource("foo@bar/baz")); | |
| 12 | assert_string_equal_free("baz", jabber_get_resource("bar/baz")); | |
| 13 | assert_string_equal_free("baz/bat", jabber_get_resource("foo@bar/baz/bat")); | |
| 14 | assert_string_equal_free("baz/bat", jabber_get_resource("bar/baz/bat")); | |
| 15 | } | |
| 16 | END_TEST | |
| 17 | ||
| 18 | START_TEST(test_get_resource_no_resource) | |
| 19 | { | |
| 20 | ||
| 21 | fail_unless(NULL == jabber_get_resource("foo@bar")); | |
| 22 | fail_unless(NULL == jabber_get_resource("bar")); | |
| 23 | } | |
| 24 | END_TEST | |
| 25 | ||
| 26 | START_TEST(test_get_bare_jid) | |
| 27 | { | |
| 28 | assert_string_equal_free("foo@bar", jabber_get_bare_jid("foo@bar")); | |
| 29 | assert_string_equal_free("foo@bar", jabber_get_bare_jid("foo@bar/baz")); | |
| 30 | assert_string_equal_free("bar", jabber_get_bare_jid("bar")); | |
| 31 | assert_string_equal_free("bar", jabber_get_bare_jid("bar/baz")); | |
| 32 | } | |
| 33 | END_TEST | |
| 34 | ||
| 35 | START_TEST(test_nodeprep_validate) | |
| 36 | { | |
|
15950
0f01bb61c5d3
Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15435
diff
changeset
|
37 | char *longnode; |
|
0f01bb61c5d3
Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15435
diff
changeset
|
38 | |
| 15155 | 39 | fail_unless(jabber_nodeprep_validate(NULL)); |
| 40 | fail_unless(jabber_nodeprep_validate("foo")); | |
| 41 | fail_unless(jabber_nodeprep_validate("%d")); | |
| 42 | fail_unless(jabber_nodeprep_validate("y\\z")); | |
| 43 | ||
|
15950
0f01bb61c5d3
Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15435
diff
changeset
|
44 | longnode = g_strnfill(1023, 'a'); |
| 15155 | 45 | fail_unless(jabber_nodeprep_validate(longnode)); |
| 46 | g_free(longnode); | |
|
27849
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
47 | |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
48 | longnode = g_strnfill(1024, 'a'); |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
49 | fail_if(jabber_nodeprep_validate(longnode)); |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
50 | g_free(longnode); |
| 15155 | 51 | } |
| 52 | END_TEST | |
| 53 | ||
| 54 | START_TEST(test_nodeprep_validate_illegal_chars) | |
| 55 | { | |
| 56 | fail_if(jabber_nodeprep_validate("don't")); | |
| 57 | fail_if(jabber_nodeprep_validate("m@ke")); | |
| 58 | fail_if(jabber_nodeprep_validate("\"me\"")); | |
| 59 | fail_if(jabber_nodeprep_validate("&ngry")); | |
| 60 | fail_if(jabber_nodeprep_validate("c:")); | |
| 61 | fail_if(jabber_nodeprep_validate("a/b")); | |
| 62 | fail_if(jabber_nodeprep_validate("4>2")); | |
| 63 | fail_if(jabber_nodeprep_validate("4<7")); | |
| 64 | } | |
| 65 | END_TEST | |
| 66 | ||
| 67 | START_TEST(test_nodeprep_validate_too_long) | |
| 68 | { | |
| 69 | char *longnode = g_strnfill(1024, 'a'); | |
| 70 | fail_if(jabber_nodeprep_validate(longnode)); | |
| 71 | g_free(longnode); | |
| 72 | } | |
| 73 | END_TEST | |
| 74 | ||
|
27710
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
75 | #define assert_valid_jid(str) { \ |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
76 | JabberID *jid = jabber_id_new(str); \ |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
77 | fail_if(jid == NULL, "JID '%s' is valid but jabber_id_new() rejected it", str); \ |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
78 | jabber_id_free(jid); \ |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
79 | } |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
80 | |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
81 | #define assert_invalid_jid(str) { \ |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
82 | JabberID *jid = jabber_id_new(str); \ |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
83 | fail_if(jid != NULL, "JID '%s' is invalid but jabber_id_new() allowed it", str); \ |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
84 | jabber_id_free(jid); \ |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
85 | } |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
86 | |
|
27818
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
87 | #define assert_jid_parts(expect_node, expect_domain, str) { \ |
|
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
88 | JabberID *jid = jabber_id_new(str); \ |
|
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
89 | fail_if(jid == NULL, "JID '%s' is valid but jabber_id_new() rejected it", str); \ |
|
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
90 | fail_if(jid->node == NULL, "JID '%s' is valid but jabber_id_new() didn't return a node", str); \ |
|
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
91 | fail_if(jid->domain == NULL, "JID '%s' is valid but jabber_id_new() didn't return a domain", str); \ |
|
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
92 | fail_if(jid->resource != NULL, "JID '%s' doesn't contain a resource", str); \ |
|
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
93 | assert_string_equal(expect_node, jid->node); \ |
|
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
94 | assert_string_equal(expect_domain, jid->domain); \ |
|
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
95 | jabber_id_free(jid); \ |
|
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
96 | } |
|
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
97 | |
|
27710
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
98 | START_TEST(test_jabber_id_new) |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
99 | { |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
100 | assert_valid_jid("gmail.com"); |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
101 | assert_valid_jid("gmail.com/Test"); |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
102 | assert_valid_jid("gmail.com/Test@"); |
| 27712 | 103 | assert_valid_jid("gmail.com/@"); |
|
27710
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
104 | assert_valid_jid("gmail.com/Test@alkjaweflkj"); |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
105 | assert_valid_jid("mark.doliner@gmail.com"); |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
106 | assert_valid_jid("mark.doliner@gmail.com/Test12345"); |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
107 | assert_valid_jid("mark.doliner@gmail.com/Test@12345"); |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
108 | assert_valid_jid("mark.doliner@gmail.com/Te/st@12@//345"); |
|
27715
6b61fbf40032
More tests, some with an international flavor. I have no idea what that
Mark Doliner <markdoliner@pidgin.im>
parents:
27712
diff
changeset
|
109 | assert_valid_jid("わいど@conference.jabber.org"); |
|
6b61fbf40032
More tests, some with an international flavor. I have no idea what that
Mark Doliner <markdoliner@pidgin.im>
parents:
27712
diff
changeset
|
110 | assert_valid_jid("まりるーむ@conference.jabber.org"); |
|
6b61fbf40032
More tests, some with an international flavor. I have no idea what that
Mark Doliner <markdoliner@pidgin.im>
parents:
27712
diff
changeset
|
111 | assert_valid_jid("mark.doliner@gmail.com/まりるーむ"); |
|
27718
ae2f4ae35df9
Whoops, some of these were asserting valid but should have been
Mark Doliner <markdoliner@pidgin.im>
parents:
27715
diff
changeset
|
112 | assert_valid_jid("mark.doliner@gmail/stuff.org"); |
|
27722
3f93427031cd
XMPP allows for internationalized domain names.
Paul Aurich <darkrain42@pidgin.im>
parents:
27718
diff
changeset
|
113 | assert_valid_jid("stuart@nödåtXäYZ.se"); |
|
3f93427031cd
XMPP allows for internationalized domain names.
Paul Aurich <darkrain42@pidgin.im>
parents:
27718
diff
changeset
|
114 | assert_valid_jid("stuart@nödåtXäYZ.se/まりるーむ"); |
|
3f93427031cd
XMPP allows for internationalized domain names.
Paul Aurich <darkrain42@pidgin.im>
parents:
27718
diff
changeset
|
115 | assert_valid_jid("mark.doliner@わいど.org"); |
|
3f93427031cd
XMPP allows for internationalized domain names.
Paul Aurich <darkrain42@pidgin.im>
parents:
27718
diff
changeset
|
116 | assert_valid_jid("nick@まつ.おおかみ.net"); |
|
27723
f209415e8338
XMPP domains can also be IPv4 or IPv6 addresses
Paul Aurich <darkrain42@pidgin.im>
parents:
27722
diff
changeset
|
117 | assert_valid_jid("paul@10.0.42.230/s"); |
|
f209415e8338
XMPP domains can also be IPv4 or IPv6 addresses
Paul Aurich <darkrain42@pidgin.im>
parents:
27722
diff
changeset
|
118 | assert_valid_jid("paul@[::1]"); /* IPv6 */ |
|
f209415e8338
XMPP domains can also be IPv4 or IPv6 addresses
Paul Aurich <darkrain42@pidgin.im>
parents:
27722
diff
changeset
|
119 | assert_valid_jid("paul@[2001:470:1f05:d58::2]"); |
|
27728
03b2a20ba465
Validate IPv6 identifiers in the domain portion of a JID.
Paul Aurich <darkrain42@pidgin.im>
parents:
27723
diff
changeset
|
120 | assert_valid_jid("paul@[2001:470:1f05:d58::2]/foo"); |
|
27710
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
121 | |
| 27712 | 122 | assert_invalid_jid("@gmail.com"); |
|
27710
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
123 | assert_invalid_jid("@@gmail.com"); |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
124 | assert_invalid_jid("mark.doliner@@gmail.com/Test12345"); |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
125 | assert_invalid_jid("mark@doliner@gmail.com/Test12345"); |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
126 | assert_invalid_jid("@gmail.com/Test@12345"); |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
127 | assert_invalid_jid("/Test@12345"); |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
128 | assert_invalid_jid("mark.doliner@"); |
|
27711
a259a8dd64cf
I thought of another invalid JID. I'm changing jabber_id_new() so that all
Mark Doliner <markdoliner@pidgin.im>
parents:
27710
diff
changeset
|
129 | assert_invalid_jid("mark.doliner/"); |
|
27718
ae2f4ae35df9
Whoops, some of these were asserting valid but should have been
Mark Doliner <markdoliner@pidgin.im>
parents:
27715
diff
changeset
|
130 | assert_invalid_jid("mark.doliner@gmail_stuff.org"); |
|
ae2f4ae35df9
Whoops, some of these were asserting valid but should have been
Mark Doliner <markdoliner@pidgin.im>
parents:
27715
diff
changeset
|
131 | assert_invalid_jid("mark.doliner@gmail[stuff.org"); |
|
ae2f4ae35df9
Whoops, some of these were asserting valid but should have been
Mark Doliner <markdoliner@pidgin.im>
parents:
27715
diff
changeset
|
132 | assert_invalid_jid("mark.doliner@gmail\\stuff.org"); |
|
27728
03b2a20ba465
Validate IPv6 identifiers in the domain portion of a JID.
Paul Aurich <darkrain42@pidgin.im>
parents:
27723
diff
changeset
|
133 | assert_invalid_jid("paul@[::1]124"); |
|
03b2a20ba465
Validate IPv6 identifiers in the domain portion of a JID.
Paul Aurich <darkrain42@pidgin.im>
parents:
27723
diff
changeset
|
134 | assert_invalid_jid("paul@2[::1]124/as"); |
|
27818
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
135 | |
|
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
136 | /* Ensure that jabber_id_new is properly lowercasing node and domains */ |
|
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
137 | assert_jid_parts("paul", "darkrain42.org", "PaUL@darkrain42.org"); |
|
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
138 | assert_jid_parts("paul", "darkrain42.org", "paul@DaRkRaIn42.org"); |
|
27849
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
139 | |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
140 | /* These case-mapping tests culled from examining RFC3454 B.2 */ |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
141 | |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
142 | /* Cyrillic capital EF (U+0424) maps to lowercase EF (U+0444) */ |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
143 | assert_jid_parts("ф", "darkrain42.org", "Ф@darkrain42.org"); |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
144 | /* |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
145 | * These character (U+A664 and U+A665) are not mapped to anything in |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
146 | * RFC3454 B.2. This first test *fails* when not using IDN because glib's |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
147 | * case-folding/utf8_strdown improperly lowercases the character. |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
148 | */ |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
149 | assert_jid_parts("Ꙥ", "darkrain42.org", "Ꙥ@darkrain42.org"); |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
150 | assert_jid_parts("ꙥ", "darkrain42.org", "ꙥ@darkrain42.org"); |
|
7f7428cb8309
When GNU Libidn is available, use it for XMPP stringprep operations.
Paul Aurich <darkrain42@pidgin.im>
parents:
27818
diff
changeset
|
151 | /* U+04E9 to U+04E9 */ |
|
27818
d2d5d265001b
Ensure UTF-8 strdown is mostly working correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
152 | assert_jid_parts("paul", "өarkrain42.org", "paul@Өarkrain42.org"); |
|
27710
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
153 | } |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
154 | END_TEST |
|
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
155 | |
| 15155 | 156 | Suite * |
| 157 | jabber_jutil_suite(void) | |
| 158 | { | |
| 159 | Suite *s = suite_create("Jabber Utility Functions"); | |
| 160 | ||
| 161 | TCase *tc = tcase_create("Get Resource"); | |
| 162 | tcase_add_test(tc, test_get_resource); | |
| 163 | tcase_add_test(tc, test_get_resource_no_resource); | |
| 164 | suite_add_tcase(s, tc); | |
| 165 | ||
| 166 | tc = tcase_create("Get Bare JID"); | |
| 167 | tcase_add_test(tc, test_get_bare_jid); | |
| 168 | suite_add_tcase(s, tc); | |
| 169 | ||
|
27710
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
170 | tc = tcase_create("JID validate"); |
| 15155 | 171 | tcase_add_test(tc, test_nodeprep_validate); |
| 172 | tcase_add_test(tc, test_nodeprep_validate_illegal_chars); | |
| 173 | tcase_add_test(tc, test_nodeprep_validate_too_long); | |
|
27710
e4b25e3c28a2
Add tests for jabber_id_new(). Please add to this! JIDs with accented
Mark Doliner <markdoliner@pidgin.im>
parents:
15953
diff
changeset
|
174 | tcase_add_test(tc, test_jabber_id_new); |
| 15155 | 175 | suite_add_tcase(s, tc); |
| 176 | ||
| 177 | return s; | |
| 178 | } |