Line data Source code
1 : #include <stdio.h>
2 : #include <stdlib.h>
3 : #include "test_helpers.h"
4 : #include "logger.h"
5 :
6 : // Globals defined in test_helpers.h
7 : int g_tests_run = 0;
8 : int g_tests_failed = 0;
9 :
10 : // Forward declarations of test suites
11 : void test_fs_util(void);
12 : void test_config_store(void);
13 : void test_logger(void);
14 : void test_wizard(void);
15 : void test_imap_client(void);
16 : void test_mime_util(void);
17 : void test_local_msg_store(void);
18 : void test_local_hdr_evict(void);
19 : void test_local_index(void);
20 : void test_manifest(void);
21 : void test_ui_prefs(void);
22 : void test_local_msg_delete(void);
23 : void test_local_index_email_extraction(void);
24 : void test_local_trash_labels(void);
25 : void test_local_gmail_history(void);
26 : void test_local_hdr_get_labels(void);
27 : void test_local_flag_search(void);
28 : void test_manifest_count_after_flag_update(void);
29 : void test_flag_search_folder_isolation(void);
30 : void test_local_contacts_update(void);
31 : void test_imap_util(void);
32 : void test_platform(void);
33 : void test_email_service(void);
34 : void test_html_parser(void);
35 : void test_html_render(void);
36 : void test_html_render_style_balance(void);
37 : void test_html_render_parent_close(void);
38 : void test_html_render_color_filter(void);
39 : void test_html_render_url_isolation(void);
40 : void test_html_render_url_color(void);
41 : void test_input_line(void);
42 : void test_path_complete(void);
43 : void run_json_util_tests(void);
44 : void test_gmail_auth(void);
45 : void test_gmail_client(void);
46 : void test_label_idx(void);
47 : void test_mail_client(void);
48 : void test_gmail_sync(void);
49 : void test_compose_service(void);
50 : void test_smtp_adapter(void);
51 : void test_mail_rules(void);
52 : void test_when_expr(void);
53 : void test_local_search(void);
54 : void test_local_contacts_rebuild(void);
55 : void test_local_pending_append(void);
56 : void test_local_pending_fetch(void);
57 : void test_local_save_outgoing(void);
58 : void test_config_settings(void);
59 : void test_config_load_account(void);
60 : void test_config_migrate(void);
61 :
62 1 : int main() {
63 1 : printf("--- email-cli Unit Test Suite ---\n\n");
64 :
65 : // Suppress mirror of ERROR logs to stderr during testing
66 1 : logger_set_stderr(0);
67 :
68 1 : RUN_TEST(test_fs_util);
69 1 : RUN_TEST(test_config_store);
70 1 : RUN_TEST(test_logger);
71 1 : RUN_TEST(test_wizard);
72 1 : RUN_TEST(test_imap_client);
73 1 : RUN_TEST(test_mime_util);
74 1 : RUN_TEST(test_local_msg_store);
75 1 : RUN_TEST(test_local_hdr_evict);
76 1 : RUN_TEST(test_local_index);
77 1 : RUN_TEST(test_manifest);
78 1 : RUN_TEST(test_ui_prefs);
79 1 : RUN_TEST(test_local_msg_delete);
80 1 : RUN_TEST(test_local_index_email_extraction);
81 1 : RUN_TEST(test_local_trash_labels);
82 1 : RUN_TEST(test_local_gmail_history);
83 1 : RUN_TEST(test_local_hdr_get_labels);
84 1 : RUN_TEST(test_local_flag_search);
85 1 : RUN_TEST(test_manifest_count_after_flag_update);
86 1 : RUN_TEST(test_flag_search_folder_isolation);
87 1 : RUN_TEST(test_local_contacts_update);
88 1 : RUN_TEST(test_local_search);
89 1 : RUN_TEST(test_local_contacts_rebuild);
90 1 : RUN_TEST(test_local_pending_append);
91 1 : RUN_TEST(test_local_pending_fetch);
92 1 : RUN_TEST(test_local_save_outgoing);
93 1 : RUN_TEST(test_imap_util);
94 1 : RUN_TEST(test_platform);
95 1 : RUN_TEST(test_email_service);
96 1 : RUN_TEST(test_html_parser);
97 1 : RUN_TEST(test_html_render);
98 1 : RUN_TEST(test_html_render_style_balance);
99 1 : RUN_TEST(test_html_render_parent_close);
100 1 : RUN_TEST(test_html_render_color_filter);
101 1 : RUN_TEST(test_html_render_url_isolation);
102 1 : RUN_TEST(test_html_render_url_color);
103 1 : RUN_TEST(test_input_line);
104 1 : RUN_TEST(test_path_complete);
105 1 : run_json_util_tests();
106 1 : RUN_TEST(test_gmail_auth);
107 1 : RUN_TEST(test_gmail_client);
108 1 : RUN_TEST(test_label_idx);
109 1 : RUN_TEST(test_mail_client);
110 1 : RUN_TEST(test_gmail_sync);
111 1 : RUN_TEST(test_compose_service);
112 1 : RUN_TEST(test_smtp_adapter);
113 1 : RUN_TEST(test_mail_rules);
114 1 : RUN_TEST(test_when_expr);
115 1 : RUN_TEST(test_config_settings);
116 1 : RUN_TEST(test_config_load_account);
117 1 : RUN_TEST(test_config_migrate);
118 :
119 1 : printf("\n--- Test Results ---\n");
120 1 : printf("Tests Run: %d\n", g_tests_run);
121 1 : printf("Tests Passed: %d\n", g_tests_run - g_tests_failed);
122 1 : printf("Tests Failed: %d\n", g_tests_failed);
123 :
124 1 : if (g_tests_failed > 0) {
125 0 : return EXIT_FAILURE;
126 : }
127 1 : return EXIT_SUCCESS;
128 : }
|