1 #include <stdarg.h>
2 #include <stdio.h>
3 #include <unistd.h>
4 #include <fcntl.h>
5 #include <stddef.h>
6 #include <setjmp.h>
7 #include <cmocka.h>
8 #include <sys/stat.h>
9 #include <stdlib.h>
10 #include <locale.h>
11 #include <langinfo.h>
12
13 #include "config.h"
14 #include "xmpp/chat_session.h"
15 #include "helpers.h"
16 #include "test_autocomplete.h"
17 #include "test_chat_session.h"
18 #include "test_common.h"
19 #include "test_contact.h"
20 #include "test_cmd_connect.h"
21 #include "test_cmd_account.h"
22 #include "test_cmd_rooms.h"
23 #include "test_cmd_sub.h"
24 #include "test_cmd_presence.h"
25 #include "test_cmd_otr.h"
26 #include "test_cmd_pgp.h"
27 #include "test_jid.h"
28 #include "test_parser.h"
29 #include "test_roster_list.h"
30 #include "test_preferences.h"
31 #include "test_server_events.h"
32 #include "test_cmd_alias.h"
33 #include "test_cmd_bookmark.h"
34 #include "test_cmd_join.h"
35 #include "test_muc.h"
36 #include "test_cmd_roster.h"
37 #include "test_cmd_disconnect.h"
38 #include "test_form.h"
39 #include "test_callbacks.h"
40 #include "test_plugins_disco.h"
41
42 int
main(int argc,char * argv[])43 main(int argc, char* argv[])
44 {
45 setlocale(LC_ALL, "en_GB.UTF-8");
46 char* codeset = nl_langinfo(CODESET);
47 char* lang = getenv("LANG");
48
49 printf("Charset information:\n");
50
51 if (lang) {
52 printf(" LANG: %s\n", lang);
53 }
54 if (codeset) {
55 printf(" CODESET: %s\n", codeset);
56 }
57 printf(" MB_CUR_MAX: %d\n", (int)MB_CUR_MAX);
58 printf(" MB_LEN_MAX: %d\n", (int)MB_LEN_MAX);
59
60 const UnitTest all_tests[] = {
61
62 unit_test(replace_one_substr),
63 unit_test(replace_one_substr_beginning),
64 unit_test(replace_one_substr_end),
65 unit_test(replace_two_substr),
66 unit_test(replace_char),
67 unit_test(replace_when_none),
68 unit_test(replace_when_match),
69 unit_test(replace_when_string_empty),
70 unit_test(replace_when_string_null),
71 unit_test(replace_when_sub_empty),
72 unit_test(replace_when_sub_null),
73 unit_test(replace_when_new_empty),
74 unit_test(replace_when_new_null),
75 unit_test(test_online_is_valid_resource_presence_string),
76 unit_test(test_chat_is_valid_resource_presence_string),
77 unit_test(test_away_is_valid_resource_presence_string),
78 unit_test(test_xa_is_valid_resource_presence_string),
79 unit_test(test_dnd_is_valid_resource_presence_string),
80 unit_test(test_available_is_not_valid_resource_presence_string),
81 unit_test(test_unavailable_is_not_valid_resource_presence_string),
82 unit_test(test_blah_is_not_valid_resource_presence_string),
83 unit_test(utf8_display_len_null_str),
84 unit_test(utf8_display_len_1_non_wide),
85 unit_test(utf8_display_len_1_wide),
86 unit_test(utf8_display_len_non_wide),
87 unit_test(utf8_display_len_wide),
88 unit_test(utf8_display_len_all_wide),
89 unit_test(strip_quotes_does_nothing_when_no_quoted),
90 unit_test(strip_quotes_strips_first),
91 unit_test(strip_quotes_strips_last),
92 unit_test(strip_quotes_strips_both),
93 unit_test(format_call_external_argv_td),
94 unit_test(unique_filename_from_url_td),
95
96 unit_test(clear_empty),
97 unit_test(reset_after_create),
98 unit_test(find_after_create),
99 unit_test(get_after_create_returns_null),
100 unit_test(add_one_and_complete),
101 unit_test(add_two_and_complete_returns_first),
102 unit_test(add_two_and_complete_returns_second),
103 unit_test(add_two_adds_two),
104 unit_test(add_two_same_adds_one),
105 unit_test(add_two_same_updates),
106 unit_test(complete_accented_with_accented),
107 unit_test(complete_accented_with_base),
108 unit_test(complete_both_with_accented),
109 unit_test(complete_both_with_base),
110 unit_test(complete_ignores_case),
111 unit_test(complete_previous),
112
113 unit_test(create_jid_from_null_returns_null),
114 unit_test(create_jid_from_empty_string_returns_null),
115 unit_test(create_jid_from_full_returns_full),
116 unit_test(create_jid_from_full_returns_bare),
117 unit_test(create_jid_from_full_returns_resourcepart),
118 unit_test(create_jid_from_full_returns_localpart),
119 unit_test(create_jid_from_full_returns_domainpart),
120 unit_test(create_jid_from_full_nolocal_returns_full),
121 unit_test(create_jid_from_full_nolocal_returns_bare),
122 unit_test(create_jid_from_full_nolocal_returns_resourcepart),
123 unit_test(create_jid_from_full_nolocal_returns_domainpart),
124 unit_test(create_jid_from_full_nolocal_returns_null_localpart),
125 unit_test(create_jid_from_bare_returns_null_full),
126 unit_test(create_jid_from_bare_returns_null_resource),
127 unit_test(create_jid_from_bare_returns_bare),
128 unit_test(create_jid_from_bare_returns_localpart),
129 unit_test(create_jid_from_bare_returns_domainpart),
130 unit_test(create_room_jid_returns_room),
131 unit_test(create_room_jid_returns_nick),
132 unit_test(create_with_slash_in_resource),
133 unit_test(create_with_at_in_resource),
134 unit_test(create_with_at_and_slash_in_resource),
135 unit_test(create_full_with_trailing_slash),
136 unit_test(returns_fulljid_when_exists),
137 unit_test(returns_barejid_when_fulljid_not_exists),
138
139 unit_test(parse_null_returns_null),
140 unit_test(parse_empty_returns_null),
141 unit_test(parse_space_returns_null),
142 unit_test(parse_cmd_no_args_returns_null),
143 unit_test(parse_cmd_with_space_returns_null),
144 unit_test(parse_cmd_with_too_few_returns_null),
145 unit_test(parse_cmd_with_too_many_returns_null),
146 unit_test(parse_cmd_one_arg),
147 unit_test(parse_cmd_two_args),
148 unit_test(parse_cmd_three_args),
149 unit_test(parse_cmd_three_args_with_spaces),
150 unit_test(parse_cmd_with_freetext),
151 unit_test(parse_cmd_one_arg_with_freetext),
152 unit_test(parse_cmd_two_args_with_freetext),
153 unit_test(parse_cmd_min_zero),
154 unit_test(parse_cmd_min_zero_with_freetext),
155 unit_test(parse_cmd_with_quoted),
156 unit_test(parse_cmd_with_quoted_and_space),
157 unit_test(parse_cmd_with_quoted_and_many_spaces),
158 unit_test(parse_cmd_with_many_quoted_and_many_spaces),
159 unit_test(parse_cmd_freetext_with_quoted),
160 unit_test(parse_cmd_freetext_with_quoted_and_space),
161 unit_test(parse_cmd_freetext_with_quoted_and_many_spaces),
162 unit_test(parse_cmd_freetext_with_many_quoted_and_many_spaces),
163 unit_test(parse_cmd_with_quoted_freetext),
164 unit_test(parse_cmd_with_third_arg_quoted_0_min_3_max),
165 unit_test(parse_cmd_with_second_arg_quoted_0_min_3_max),
166 unit_test(parse_cmd_with_second_and_third_arg_quoted_0_min_3_max),
167 unit_test(count_one_token),
168 unit_test(count_one_token_quoted_no_whitespace),
169 unit_test(count_one_token_quoted_with_whitespace),
170 unit_test(count_two_tokens),
171 unit_test(count_two_tokens_first_quoted),
172 unit_test(count_two_tokens_second_quoted),
173 unit_test(count_two_tokens_both_quoted),
174 unit_test(get_first_of_one),
175 unit_test(get_first_of_two),
176 unit_test(get_first_two_of_three),
177 unit_test(get_first_two_of_three_first_quoted),
178 unit_test(get_first_two_of_three_second_quoted),
179 unit_test(get_first_two_of_three_first_and_second_quoted),
180 unit_test(parse_options_when_none_returns_empty_hasmap),
181 unit_test(parse_options_when_opt1_no_val_sets_error),
182 unit_test(parse_options_when_one_returns_map),
183 unit_test(parse_options_when_opt2_no_val_sets_error),
184 unit_test(parse_options_when_two_returns_map),
185 unit_test(parse_options_when_opt3_no_val_sets_error),
186 unit_test(parse_options_when_three_returns_map),
187 unit_test(parse_options_when_unknown_opt_sets_error),
188 unit_test(parse_options_with_duplicated_option_sets_error),
189
190 unit_test(empty_list_when_none_added),
191 unit_test(contains_one_element),
192 unit_test(first_element_correct),
193 unit_test(contains_two_elements),
194 unit_test(first_and_second_elements_correct),
195 unit_test(contains_three_elements),
196 unit_test(first_three_elements_correct),
197 unit_test(add_twice_at_beginning_adds_once),
198 unit_test(add_twice_in_middle_adds_once),
199 unit_test(add_twice_at_end_adds_once),
200 unit_test(find_first_exists),
201 unit_test(find_second_exists),
202 unit_test(find_third_exists),
203 unit_test(find_returns_null),
204 unit_test(find_on_empty_returns_null),
205 unit_test(find_twice_returns_second_when_two_match),
206 unit_test(find_five_times_finds_fifth),
207 unit_test(find_twice_returns_first_when_two_match_and_reset),
208 unit_test(add_contact_with_no_group),
209 unit_test(add_contact_with_group),
210 unit_test(add_contact_with_two_groups),
211 unit_test(add_contact_with_three_groups),
212 unit_test(add_contact_with_three_groups_update_adding_two),
213 unit_test(add_contact_with_three_groups_update_removing_one),
214 unit_test(add_contact_with_three_groups_update_removing_two),
215 unit_test(add_contact_with_three_groups_update_removing_three),
216 unit_test(add_contact_with_three_groups_update_two_new),
217 unit_test(add_remove_contact_groups),
218 unit_test(add_contacts_with_different_groups),
219 unit_test(add_contacts_with_same_groups),
220 unit_test(add_contacts_with_overlapping_groups),
221 unit_test(remove_contact_with_remaining_in_group),
222 unit_test(get_contact_display_name),
223 unit_test(get_contact_display_name_is_barejid_if_name_is_empty),
224 unit_test(get_contact_display_name_is_passed_barejid_if_contact_does_not_exist),
225
226 unit_test_setup_teardown(returns_false_when_chat_session_does_not_exist,
227 init_chat_sessions,
228 close_chat_sessions),
229 unit_test_setup_teardown(creates_chat_session_on_recipient_activity,
230 init_chat_sessions,
231 close_chat_sessions),
232 unit_test_setup_teardown(replaces_chat_session_on_recipient_activity_with_different_resource,
233 init_chat_sessions,
234 close_chat_sessions),
235 unit_test_setup_teardown(removes_chat_session,
236 init_chat_sessions,
237 close_chat_sessions),
238
239 unit_test_setup_teardown(cmd_connect_shows_message_when_disconnecting,
240 load_preferences,
241 close_preferences),
242 unit_test_setup_teardown(cmd_connect_shows_message_when_connecting,
243 load_preferences,
244 close_preferences),
245 unit_test_setup_teardown(cmd_connect_shows_message_when_connected,
246 load_preferences,
247 close_preferences),
248 unit_test_setup_teardown(cmd_connect_when_no_account,
249 load_preferences,
250 close_preferences),
251 unit_test_setup_teardown(cmd_connect_fail_message,
252 load_preferences,
253 close_preferences),
254 unit_test_setup_teardown(cmd_connect_lowercases_argument_with_account,
255 load_preferences,
256 close_preferences),
257 unit_test_setup_teardown(cmd_connect_lowercases_argument_with_no_account,
258 load_preferences,
259 close_preferences),
260 unit_test_setup_teardown(cmd_connect_asks_password_when_not_in_account,
261 load_preferences,
262 close_preferences),
263 unit_test_setup_teardown(cmd_connect_shows_usage_when_no_server_value,
264 load_preferences,
265 close_preferences),
266 unit_test_setup_teardown(cmd_connect_shows_message_when_connecting_with_account,
267 load_preferences,
268 close_preferences),
269 unit_test_setup_teardown(cmd_connect_connects_with_account,
270 load_preferences,
271 close_preferences),
272 unit_test_setup_teardown(cmd_connect_shows_usage_when_server_no_port_value,
273 load_preferences,
274 close_preferences),
275 unit_test_setup_teardown(cmd_connect_shows_usage_when_no_port_value,
276 load_preferences,
277 close_preferences),
278 unit_test_setup_teardown(cmd_connect_shows_usage_when_port_no_server_value,
279 load_preferences,
280 close_preferences),
281 unit_test_setup_teardown(cmd_connect_shows_message_when_port_0,
282 load_preferences,
283 close_preferences),
284 unit_test_setup_teardown(cmd_connect_shows_message_when_port_minus1,
285 load_preferences,
286 close_preferences),
287 unit_test_setup_teardown(cmd_connect_shows_message_when_port_65536,
288 load_preferences,
289 close_preferences),
290 unit_test_setup_teardown(cmd_connect_shows_message_when_port_contains_chars,
291 load_preferences,
292 close_preferences),
293 unit_test_setup_teardown(cmd_connect_with_server_when_provided,
294 load_preferences,
295 close_preferences),
296 unit_test_setup_teardown(cmd_connect_with_port_when_provided,
297 load_preferences,
298 close_preferences),
299 unit_test_setup_teardown(cmd_connect_with_server_and_port_when_provided,
300 load_preferences,
301 close_preferences),
302 unit_test_setup_teardown(cmd_connect_shows_usage_when_server_provided_twice,
303 load_preferences,
304 close_preferences),
305 unit_test_setup_teardown(cmd_connect_shows_usage_when_port_provided_twice,
306 load_preferences,
307 close_preferences),
308 unit_test_setup_teardown(cmd_connect_shows_usage_when_invalid_first_property,
309 load_preferences,
310 close_preferences),
311 unit_test_setup_teardown(cmd_connect_shows_usage_when_invalid_second_property,
312 load_preferences,
313 close_preferences),
314
315 unit_test(cmd_rooms_shows_message_when_disconnected),
316 unit_test(cmd_rooms_shows_message_when_disconnecting),
317 unit_test(cmd_rooms_shows_message_when_connecting),
318 unit_test(cmd_rooms_uses_account_default_when_no_arg),
319 unit_test(cmd_rooms_service_arg_used_when_passed),
320 unit_test(cmd_rooms_filter_arg_used_when_passed),
321
322 unit_test(cmd_account_shows_usage_when_not_connected_and_no_args),
323 unit_test(cmd_account_shows_account_when_connected_and_no_args),
324 unit_test(cmd_account_list_shows_accounts),
325 unit_test(cmd_account_show_shows_usage_when_no_arg),
326 unit_test(cmd_account_show_shows_message_when_account_does_not_exist),
327 unit_test(cmd_account_show_shows_account_when_exists),
328 unit_test(cmd_account_add_shows_usage_when_no_arg),
329 unit_test(cmd_account_add_adds_account),
330 unit_test(cmd_account_enable_shows_usage_when_no_arg),
331 unit_test(cmd_account_enable_enables_account),
332 unit_test(cmd_account_enable_shows_message_when_account_doesnt_exist),
333 unit_test(cmd_account_disable_shows_usage_when_no_arg),
334 unit_test(cmd_account_disable_disables_account),
335 unit_test(cmd_account_disable_shows_message_when_account_doesnt_exist),
336 unit_test(cmd_account_rename_shows_usage_when_no_args),
337 unit_test(cmd_account_rename_shows_usage_when_one_arg),
338 unit_test(cmd_account_rename_renames_account),
339 unit_test(cmd_account_rename_shows_message_when_not_renamed),
340 unit_test(cmd_account_set_shows_usage_when_no_args),
341 unit_test(cmd_account_set_shows_usage_when_one_arg),
342 unit_test(cmd_account_set_shows_usage_when_two_args),
343 unit_test(cmd_account_set_shows_message_when_account_doesnt_exist),
344 unit_test(cmd_account_set_jid_shows_message_for_malformed_jid),
345 unit_test(cmd_account_set_jid_sets_barejid),
346 unit_test(cmd_account_set_jid_sets_resource),
347 unit_test(cmd_account_set_server_sets_server),
348 unit_test(cmd_account_set_resource_sets_resource),
349 unit_test(cmd_account_set_resource_sets_resource_with_online_message),
350 unit_test(cmd_account_set_password_sets_password),
351 unit_test(cmd_account_set_eval_password_sets_eval_password),
352 unit_test(cmd_account_set_password_when_eval_password_set),
353 unit_test(cmd_account_set_eval_password_when_password_set),
354 unit_test(cmd_account_set_muc_sets_muc),
355 unit_test(cmd_account_set_nick_sets_nick),
356 #ifdef HAVE_LIBOTR
357 unit_test(cmd_account_show_message_for_missing_otr_policy),
358 unit_test(cmd_account_show_message_for_invalid_otr_policy),
359 unit_test(cmd_account_set_otr_sets_otr),
360 #endif
361 unit_test(cmd_account_set_status_shows_message_when_invalid_status),
362 unit_test(cmd_account_set_status_sets_status_when_valid),
363 unit_test(cmd_account_set_status_sets_status_when_last),
364 unit_test(cmd_account_set_invalid_presence_string_priority_shows_message),
365 unit_test(cmd_account_set_last_priority_shows_message),
366 unit_test(cmd_account_set_online_priority_sets_preference),
367 unit_test(cmd_account_set_chat_priority_sets_preference),
368 unit_test(cmd_account_set_away_priority_sets_preference),
369 unit_test(cmd_account_set_xa_priority_sets_preference),
370 unit_test(cmd_account_set_dnd_priority_sets_preference),
371 unit_test(cmd_account_set_priority_too_low_shows_message),
372 unit_test(cmd_account_set_priority_too_high_shows_message),
373 unit_test(cmd_account_set_priority_when_not_number_shows_message),
374 unit_test(cmd_account_set_priority_when_empty_shows_message),
375 unit_test(cmd_account_set_priority_updates_presence_when_account_connected_with_presence),
376 unit_test(cmd_account_clear_shows_usage_when_no_args),
377 unit_test(cmd_account_clear_shows_usage_when_one_arg),
378 unit_test(cmd_account_clear_shows_message_when_account_doesnt_exist),
379 unit_test(cmd_account_clear_shows_message_when_invalid_property),
380
381 unit_test(cmd_sub_shows_message_when_not_connected),
382 unit_test(cmd_sub_shows_usage_when_no_arg),
383
384 unit_test(contact_in_group),
385 unit_test(contact_not_in_group),
386 unit_test(contact_name_when_name_exists),
387 unit_test(contact_jid_when_name_not_exists),
388 unit_test(contact_string_when_name_exists),
389 unit_test(contact_string_when_name_not_exists),
390 unit_test(contact_string_when_default_resource),
391 unit_test(contact_presence_offline),
392 unit_test(contact_presence_uses_highest_priority),
393 unit_test(contact_presence_chat_when_same_prioroty),
394 unit_test(contact_presence_online_when_same_prioroty),
395 unit_test(contact_presence_away_when_same_prioroty),
396 unit_test(contact_presence_xa_when_same_prioroty),
397 unit_test(contact_presence_dnd),
398 unit_test(contact_subscribed_when_to),
399 unit_test(contact_subscribed_when_both),
400 unit_test(contact_not_subscribed_when_from),
401 unit_test(contact_not_subscribed_when_no_subscription_value),
402 unit_test(contact_not_available),
403 unit_test(contact_not_available_when_highest_priority_away),
404 unit_test(contact_not_available_when_highest_priority_xa),
405 unit_test(contact_not_available_when_highest_priority_dnd),
406 unit_test(contact_available_when_highest_priority_online),
407 unit_test(contact_available_when_highest_priority_chat),
408
409 unit_test(cmd_presence_shows_usage_when_bad_subcmd),
410 unit_test(cmd_presence_shows_usage_when_bad_console_setting),
411 unit_test(cmd_presence_shows_usage_when_bad_chat_setting),
412 unit_test(cmd_presence_shows_usage_when_bad_muc_setting),
413 unit_test_setup_teardown(cmd_presence_console_sets_all,
414 load_preferences,
415 close_preferences),
416 unit_test_setup_teardown(cmd_presence_console_sets_online,
417 load_preferences,
418 close_preferences),
419 unit_test_setup_teardown(cmd_presence_console_sets_none,
420 load_preferences,
421 close_preferences),
422 unit_test_setup_teardown(cmd_presence_chat_sets_all,
423 load_preferences,
424 close_preferences),
425 unit_test_setup_teardown(cmd_presence_chat_sets_online,
426 load_preferences,
427 close_preferences),
428 unit_test_setup_teardown(cmd_presence_chat_sets_none,
429 load_preferences,
430 close_preferences),
431 unit_test_setup_teardown(cmd_presence_room_sets_all,
432 load_preferences,
433 close_preferences),
434 unit_test_setup_teardown(cmd_presence_room_sets_online,
435 load_preferences,
436 close_preferences),
437 unit_test_setup_teardown(cmd_presence_room_sets_none,
438 load_preferences,
439 close_preferences),
440
441 unit_test_setup_teardown(statuses_console_defaults_to_all,
442 load_preferences,
443 close_preferences),
444 unit_test_setup_teardown(statuses_chat_defaults_to_all,
445 load_preferences,
446 close_preferences),
447 unit_test_setup_teardown(statuses_muc_defaults_to_all,
448 load_preferences,
449 close_preferences),
450
451 unit_test_setup_teardown(console_shows_online_presence_when_set_online,
452 load_preferences,
453 close_preferences),
454 unit_test_setup_teardown(console_shows_online_presence_when_set_all,
455 load_preferences,
456 close_preferences),
457 unit_test_setup_teardown(console_shows_dnd_presence_when_set_all,
458 load_preferences,
459 close_preferences),
460 unit_test_setup_teardown(handle_offline_removes_chat_session,
461 load_preferences,
462 close_preferences),
463 unit_test(lost_connection_clears_chat_sessions),
464
465 unit_test(cmd_alias_add_shows_usage_when_no_args),
466 unit_test(cmd_alias_add_shows_usage_when_no_value),
467 unit_test(cmd_alias_remove_shows_usage_when_no_args),
468 unit_test(cmd_alias_show_usage_when_invalid_subcmd),
469 unit_test_setup_teardown(cmd_alias_add_adds_alias,
470 load_preferences,
471 close_preferences),
472 unit_test_setup_teardown(cmd_alias_add_shows_message_when_exists,
473 load_preferences,
474 close_preferences),
475 unit_test_setup_teardown(cmd_alias_remove_removes_alias,
476 load_preferences,
477 close_preferences),
478 unit_test_setup_teardown(cmd_alias_remove_shows_message_when_no_alias,
479 load_preferences,
480 close_preferences),
481 unit_test_setup_teardown(cmd_alias_list_shows_all_aliases,
482 load_preferences,
483 close_preferences),
484
485 unit_test_setup_teardown(test_muc_invites_add, muc_before_test, muc_after_test),
486 unit_test_setup_teardown(test_muc_remove_invite, muc_before_test, muc_after_test),
487 unit_test_setup_teardown(test_muc_invites_count_0, muc_before_test, muc_after_test),
488 unit_test_setup_teardown(test_muc_invites_count_5, muc_before_test, muc_after_test),
489 unit_test_setup_teardown(test_muc_room_is_not_active, muc_before_test, muc_after_test),
490 unit_test_setup_teardown(test_muc_active, muc_before_test, muc_after_test),
491
492 unit_test(cmd_bookmark_shows_message_when_disconnected),
493 unit_test(cmd_bookmark_shows_message_when_disconnecting),
494 unit_test(cmd_bookmark_shows_message_when_connecting),
495 unit_test(cmd_bookmark_shows_usage_when_no_args),
496 unit_test(cmd_bookmark_list_shows_bookmarks),
497 unit_test(cmd_bookmark_add_shows_message_when_invalid_jid),
498 unit_test(cmd_bookmark_add_adds_bookmark_with_jid),
499 unit_test(cmd_bookmark_uses_roomjid_in_room),
500 unit_test(cmd_bookmark_add_uses_roomjid_in_room),
501 unit_test(cmd_bookmark_add_uses_supplied_jid_in_room),
502 unit_test(cmd_bookmark_remove_uses_roomjid_in_room),
503 unit_test(cmd_bookmark_remove_uses_supplied_jid_in_room),
504 unit_test(cmd_bookmark_add_adds_bookmark_with_jid_nick),
505 unit_test(cmd_bookmark_add_adds_bookmark_with_jid_autojoin),
506 unit_test(cmd_bookmark_add_adds_bookmark_with_jid_nick_autojoin),
507 unit_test(cmd_bookmark_remove_removes_bookmark),
508 unit_test(cmd_bookmark_remove_shows_message_when_no_bookmark),
509
510 #ifdef HAVE_LIBOTR
511 unit_test(cmd_otr_log_shows_usage_when_no_args),
512 unit_test(cmd_otr_log_shows_usage_when_invalid_subcommand),
513 unit_test_setup_teardown(cmd_otr_log_on_enables_logging,
514 load_preferences,
515 close_preferences),
516 unit_test_setup_teardown(cmd_otr_log_off_disables_logging,
517 load_preferences,
518 close_preferences),
519 unit_test_setup_teardown(cmd_otr_redact_redacts_logging,
520 load_preferences,
521 close_preferences),
522 unit_test_setup_teardown(cmd_otr_log_on_shows_warning_when_chlog_disabled,
523 load_preferences,
524 close_preferences),
525 unit_test_setup_teardown(cmd_otr_log_redact_shows_warning_when_chlog_disabled,
526 load_preferences,
527 close_preferences),
528 unit_test(cmd_otr_libver_shows_libotr_version),
529 unit_test(cmd_otr_gen_shows_message_when_not_connected),
530 unit_test(cmd_otr_gen_generates_key_for_connected_account),
531 unit_test(cmd_otr_gen_shows_message_when_disconnected),
532 unit_test(cmd_otr_gen_shows_message_when_connecting),
533 unit_test(cmd_otr_gen_shows_message_when_disconnecting),
534 unit_test(cmd_otr_myfp_shows_message_when_disconnected),
535 unit_test(cmd_otr_myfp_shows_message_when_connecting),
536 unit_test(cmd_otr_myfp_shows_message_when_disconnecting),
537 unit_test(cmd_otr_myfp_shows_message_when_no_key),
538 unit_test(cmd_otr_myfp_shows_my_fingerprint),
539 unit_test(cmd_otr_theirfp_shows_message_when_in_console),
540 unit_test(cmd_otr_theirfp_shows_message_when_in_muc),
541 unit_test(cmd_otr_theirfp_shows_message_when_in_private),
542 unit_test(cmd_otr_theirfp_shows_message_when_non_otr_chat_window),
543 unit_test(cmd_otr_theirfp_shows_fingerprint),
544 unit_test(cmd_otr_start_shows_message_when_in_console),
545 unit_test(cmd_otr_start_shows_message_when_in_muc),
546 unit_test(cmd_otr_start_shows_message_when_in_private),
547 unit_test(cmd_otr_start_shows_message_when_already_started),
548 unit_test(cmd_otr_start_shows_message_when_no_key),
549 unit_test_setup_teardown(cmd_otr_start_sends_otr_query_message_to_current_recipeint,
550 load_preferences,
551 close_preferences),
552 #else
553 unit_test(cmd_otr_shows_message_when_otr_unsupported),
554 #endif
555
556 #ifdef HAVE_LIBGPGME
557 unit_test(cmd_pgp_shows_usage_when_no_args),
558 unit_test(cmd_pgp_start_shows_message_when_disconnected),
559 unit_test(cmd_pgp_start_shows_message_when_disconnecting),
560 unit_test(cmd_pgp_start_shows_message_when_connecting),
561 unit_test(cmd_pgp_start_shows_message_when_no_arg_in_console),
562 unit_test(cmd_pgp_start_shows_message_when_no_arg_in_muc),
563 unit_test(cmd_pgp_start_shows_message_when_no_arg_in_conf),
564 unit_test(cmd_pgp_start_shows_message_when_no_arg_in_private),
565 unit_test(cmd_pgp_start_shows_message_when_no_arg_in_xmlconsole),
566 #else
567 unit_test(cmd_pgp_shows_message_when_pgp_unsupported),
568 #endif
569
570 unit_test(cmd_join_shows_message_when_disconnecting),
571 unit_test(cmd_join_shows_message_when_connecting),
572 unit_test(cmd_join_shows_message_when_disconnected),
573 unit_test(cmd_join_shows_error_message_when_invalid_room_jid),
574 unit_test(cmd_join_uses_account_mucservice_when_no_service_specified),
575 unit_test(cmd_join_uses_supplied_nick),
576 unit_test(cmd_join_uses_account_nick_when_not_supplied),
577 unit_test(cmd_join_uses_password_when_supplied),
578
579 unit_test(cmd_roster_shows_message_when_disconnecting),
580 unit_test(cmd_roster_shows_message_when_connecting),
581 unit_test(cmd_roster_shows_message_when_disconnected),
582 unit_test(cmd_roster_shows_roster_when_no_args),
583 unit_test(cmd_roster_add_shows_message_when_no_jid),
584 unit_test(cmd_roster_add_sends_roster_add_request),
585 unit_test(cmd_roster_remove_shows_message_when_no_jid),
586 unit_test(cmd_roster_remove_sends_roster_remove_request),
587 unit_test(cmd_roster_nick_shows_message_when_no_jid),
588 unit_test(cmd_roster_nick_shows_message_when_no_nick),
589 unit_test(cmd_roster_nick_shows_message_when_no_contact_exists),
590 unit_test(cmd_roster_nick_sends_name_change_request),
591 unit_test(cmd_roster_clearnick_shows_message_when_no_jid),
592 unit_test(cmd_roster_clearnick_shows_message_when_no_contact_exists),
593 unit_test(cmd_roster_clearnick_sends_name_change_request_with_empty_nick),
594
595 unit_test(get_form_type_field_returns_null_no_fields),
596 unit_test(get_form_type_field_returns_null_when_not_present),
597 unit_test(get_form_type_field_returns_value_when_present),
598 unit_test(get_field_type_returns_unknown_when_no_fields),
599 unit_test(get_field_type_returns_correct_type),
600 unit_test(set_value_adds_when_none),
601 unit_test(set_value_updates_when_one),
602 unit_test(add_unique_value_adds_when_none),
603 unit_test(add_unique_value_does_nothing_when_exists),
604 unit_test(add_unique_value_adds_when_doesnt_exist),
605 unit_test(add_value_adds_when_none),
606 unit_test(add_value_adds_when_some),
607 unit_test(add_value_adds_when_exists),
608 unit_test(remove_value_does_nothing_when_none),
609 unit_test(remove_value_does_nothing_when_doesnt_exist),
610 unit_test(remove_value_removes_when_one),
611 unit_test(remove_value_removes_when_many),
612 unit_test(remove_text_multi_value_does_nothing_when_none),
613 unit_test(remove_text_multi_value_does_nothing_when_doesnt_exist),
614 unit_test(remove_text_multi_value_removes_when_one),
615 unit_test(remove_text_multi_value_removes_when_many),
616
617 unit_test_setup_teardown(clears_chat_sessions,
618 load_preferences,
619 close_preferences),
620
621 unit_test(prof_partial_occurrences_tests),
622 unit_test(prof_whole_occurrences_tests),
623
624 unit_test(returns_no_commands),
625 unit_test(returns_commands),
626
627 unit_test(returns_empty_list_when_none),
628 unit_test(returns_added_feature),
629 unit_test(resets_features_on_close),
630 unit_test(returns_all_added_features),
631 unit_test(does_not_add_duplicate_feature),
632 unit_test(removes_plugin_features),
633 unit_test(does_not_remove_feature_when_more_than_one_reference),
634 };
635
636 return run_tests(all_tests);
637 }
638