This source file includes following definitions.
- get_current_type
- panel_cd
- sync_tree
- 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 "src/filemanager/cd.c"
32
33
34
35 panel_view_mode_t
36 get_current_type (void)
37 {
38 return view_listing;
39 }
40
41 gboolean
42 panel_cd (WPanel *panel, const vfs_path_t *new_dir_vpath, enum cd_enum cd_type)
43 {
44 (void) panel;
45 (void) new_dir_vpath;
46 (void) cd_type;
47
48 return TRUE;
49 }
50
51 void
52 sync_tree (const vfs_path_t *vpath)
53 {
54 (void) vpath;
55 }
56
57
58
59 #define check_examine_cd(input, etalon) \
60 { \
61 result = examine_cd (input); \
62 ck_assert_msg (strcmp (result->str, etalon) == 0, \
63 "\ninput (%s)\nactial (%s) not equal to\netalon (%s)", input, result->str, \
64 etalon); \
65 g_string_free (result, TRUE); \
66 }
67
68 START_TEST (test_examine_cd)
69 {
70 GString *result;
71
72 g_setenv ("AAA", "aaa", TRUE);
73
74 check_examine_cd ("/test/path", "/test/path");
75
76 check_examine_cd ("$AAA", "aaa");
77 check_examine_cd ("${AAA}", "aaa");
78 check_examine_cd ("$AAA/test", "aaa/test");
79 check_examine_cd ("${AAA}/test", "aaa/test");
80
81 check_examine_cd ("/$AAA", "/aaa");
82 check_examine_cd ("/${AAA}", "/aaa");
83 check_examine_cd ("/$AAA/test", "/aaa/test");
84 check_examine_cd ("/${AAA}/test", "/aaa/test");
85
86 check_examine_cd ("/test/path/$AAA", "/test/path/aaa");
87 check_examine_cd ("/test/path/$AAA/test2", "/test/path/aaa/test2");
88 check_examine_cd ("/test/path/test1$AAA/test2", "/test/path/test1aaa/test2");
89
90 check_examine_cd ("/test/path/${AAA}", "/test/path/aaa");
91 check_examine_cd ("/test/path/${AAA}/test2", "/test/path/aaa/test2");
92 check_examine_cd ("/test/path/${AAA}test2", "/test/path/aaatest2");
93 check_examine_cd ("/test/path/test1${AAA}", "/test/path/test1aaa");
94 check_examine_cd ("/test/path/test1${AAA}test2", "/test/path/test1aaatest2");
95
96 check_examine_cd ("/test/path/\\$AAA", "/test/path/$AAA");
97 check_examine_cd ("/test/path/\\$AAA/test2", "/test/path/$AAA/test2");
98 check_examine_cd ("/test/path/test1\\$AAA", "/test/path/test1$AAA");
99
100 check_examine_cd ("/test/path/\\${AAA}", "/test/path/${AAA}");
101 check_examine_cd ("/test/path/\\${AAA}/test2", "/test/path/${AAA}/test2");
102 check_examine_cd ("/test/path/\\${AAA}test2", "/test/path/${AAA}test2");
103 check_examine_cd ("/test/path/test1\\${AAA}test2", "/test/path/test1${AAA}test2");
104 }
105 END_TEST
106
107
108
109 int
110 main (void)
111 {
112 TCase *tc_core;
113
114 tc_core = tcase_create ("Core");
115
116
117 tcase_add_test (tc_core, test_examine_cd);
118
119
120 return mctest_run_all (tc_core);
121 }
122
123