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