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, \
80 etalon); \
81 g_string_free (result, TRUE); \
82 }
83
84 START_TEST (test_examine_cd)
85 {
86 GString *result;
87
88 g_setenv ("AAA", "aaa", TRUE);
89
90 check_examine_cd ("/test/path", "/test/path");
91
92 check_examine_cd ("$AAA", "aaa");
93 check_examine_cd ("${AAA}", "aaa");
94 check_examine_cd ("$AAA/test", "aaa/test");
95 check_examine_cd ("${AAA}/test", "aaa/test");
96
97 check_examine_cd ("/$AAA", "/aaa");
98 check_examine_cd ("/${AAA}", "/aaa");
99 check_examine_cd ("/$AAA/test", "/aaa/test");
100 check_examine_cd ("/${AAA}/test", "/aaa/test");
101
102 check_examine_cd ("/test/path/$AAA", "/test/path/aaa");
103 check_examine_cd ("/test/path/$AAA/test2", "/test/path/aaa/test2");
104 check_examine_cd ("/test/path/test1$AAA/test2", "/test/path/test1aaa/test2");
105
106 check_examine_cd ("/test/path/${AAA}", "/test/path/aaa");
107 check_examine_cd ("/test/path/${AAA}/test2", "/test/path/aaa/test2");
108 check_examine_cd ("/test/path/${AAA}test2", "/test/path/aaatest2");
109 check_examine_cd ("/test/path/test1${AAA}", "/test/path/test1aaa");
110 check_examine_cd ("/test/path/test1${AAA}test2", "/test/path/test1aaatest2");
111
112 check_examine_cd ("/test/path/\\$AAA", "/test/path/$AAA");
113 check_examine_cd ("/test/path/\\$AAA/test2", "/test/path/$AAA/test2");
114 check_examine_cd ("/test/path/test1\\$AAA", "/test/path/test1$AAA");
115
116 check_examine_cd ("/test/path/\\${AAA}", "/test/path/${AAA}");
117 check_examine_cd ("/test/path/\\${AAA}/test2", "/test/path/${AAA}/test2");
118 check_examine_cd ("/test/path/\\${AAA}test2", "/test/path/${AAA}test2");
119 check_examine_cd ("/test/path/test1\\${AAA}test2", "/test/path/test1${AAA}test2");
120 }
121 END_TEST
122
123
124
125 int
126 main (void)
127 {
128 TCase *tc_core;
129
130 tc_core = tcase_create ("Core");
131
132 tcase_add_checked_fixture (tc_core, setup, teardown);
133
134
135 tcase_add_test (tc_core, test_examine_cd);
136
137
138 return mctest_run_all (tc_core);
139 }
140
141