This source file includes following definitions.
- get_current_type
- panel_cd
- sync_tree
- setup
- teardown
- START_TEST
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #define TEST_SUITE_NAME "/src/filemanager"
28
29 #include "tests/mctest.h"
30
31 #include <stdio.h>
32
33 #include "src/filemanager/cd.c"
34
35
36
37 WPanel *current_panel = NULL;
38
39 panel_view_mode_t
40 get_current_type (void)
41 {
42 return view_listing;
43 }
44
45 gboolean
46 panel_cd (WPanel *panel, const vfs_path_t *new_dir_vpath, enum cd_enum cd_type)
47 {
48 (void) panel;
49 (void) new_dir_vpath;
50 (void) cd_type;
51
52 return TRUE;
53 }
54
55 void
56 sync_tree (const vfs_path_t *vpath)
57 {
58 (void) vpath;
59 }
60
61
62
63 static void
64 setup (void)
65 {
66 }
67
68 static void
69 teardown (void)
70 {
71 }
72
73
74
75 #define check_examine_cd(input, etalon) \
76 { \
77 result = examine_cd (input); \
78 ck_assert_msg (strcmp (result->str, etalon) == 0, \
79 "\ninput (%s)\nactial (%s) not equal to\netalon (%s)", input, result->str, etalon); \
80 g_string_free (result, TRUE); \
81 }
82
83
84 START_TEST (test_examine_cd)
85
86 {
87 GString *result;
88
89 g_setenv ("AAA", "aaa", TRUE);
90
91 check_examine_cd ("/test/path", "/test/path");
92
93 check_examine_cd ("$AAA", "aaa");
94 check_examine_cd ("${AAA}", "aaa");
95 check_examine_cd ("$AAA/test", "aaa/test");
96 check_examine_cd ("${AAA}/test", "aaa/test");
97
98 check_examine_cd ("/$AAA", "/aaa");
99 check_examine_cd ("/${AAA}", "/aaa");
100 check_examine_cd ("/$AAA/test", "/aaa/test");
101 check_examine_cd ("/${AAA}/test", "/aaa/test");
102
103 check_examine_cd ("/test/path/$AAA", "/test/path/aaa");
104 check_examine_cd ("/test/path/$AAA/test2", "/test/path/aaa/test2");
105 check_examine_cd ("/test/path/test1$AAA/test2", "/test/path/test1aaa/test2");
106
107 check_examine_cd ("/test/path/${AAA}", "/test/path/aaa");
108 check_examine_cd ("/test/path/${AAA}/test2", "/test/path/aaa/test2");
109 check_examine_cd ("/test/path/${AAA}test2", "/test/path/aaatest2");
110 check_examine_cd ("/test/path/test1${AAA}", "/test/path/test1aaa");
111 check_examine_cd ("/test/path/test1${AAA}test2", "/test/path/test1aaatest2");
112
113 check_examine_cd ("/test/path/\\$AAA", "/test/path/$AAA");
114 check_examine_cd ("/test/path/\\$AAA/test2", "/test/path/$AAA/test2");
115 check_examine_cd ("/test/path/test1\\$AAA", "/test/path/test1$AAA");
116
117 check_examine_cd ("/test/path/\\${AAA}", "/test/path/${AAA}");
118 check_examine_cd ("/test/path/\\${AAA}/test2", "/test/path/${AAA}/test2");
119 check_examine_cd ("/test/path/\\${AAA}test2", "/test/path/${AAA}test2");
120 check_examine_cd ("/test/path/test1\\${AAA}test2", "/test/path/test1${AAA}test2");
121 }
122
123 END_TEST
124
125
126
127
128 int
129 main (void)
130 {
131 TCase *tc_core;
132
133 tc_core = tcase_create ("Core");
134
135 tcase_add_checked_fixture (tc_core, setup, teardown);
136
137
138 tcase_add_test (tc_core, test_examine_cd);
139
140
141 return mctest_run_all (tc_core);
142 }
143
144