| File tests/completion/add_hook.c changed (mode: 100644) (index 379cd23d9..6fb27390c) |
| ... |
... |
add_dquotes(const char match[]) |
| 14 |
14 |
|
|
| 15 |
15 |
TEST(set_add_path_hook_sets_hook) |
TEST(set_add_path_hook_sets_hook) |
| 16 |
16 |
{ |
{ |
| 17 |
|
char *match; |
|
| 18 |
|
|
|
| 19 |
17 |
vle_compl_set_add_path_hook(&add_dquotes); |
vle_compl_set_add_path_hook(&add_dquotes); |
| 20 |
18 |
|
|
| 21 |
19 |
assert_int_equal(0, vle_compl_add_path_match("a b c")); |
assert_int_equal(0, vle_compl_add_path_match("a b c")); |
| |
| ... |
... |
TEST(set_add_path_hook_sets_hook) |
| 24 |
22 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 25 |
23 |
assert_int_equal(3, vle_compl_get_count()); |
assert_int_equal(3, vle_compl_get_count()); |
| 26 |
24 |
|
|
| 27 |
|
match = vle_compl_next(); |
|
| 28 |
|
assert_string_equal("\"a b c\"", match); |
|
|
25 |
|
char *match; |
|
26 |
|
assert_string_equal("\"a b c\"", match = vle_compl_next()); |
| 29 |
27 |
free(match); |
free(match); |
| 30 |
|
|
|
| 31 |
|
match = vle_compl_next(); |
|
| 32 |
|
assert_string_equal("\"a b\"", match); |
|
|
28 |
|
assert_string_equal("\"a b\"", match = vle_compl_next()); |
| 33 |
29 |
free(match); |
free(match); |
| 34 |
|
|
|
| 35 |
|
match = vle_compl_next(); |
|
| 36 |
|
assert_string_equal("\"a\"", match); |
|
|
30 |
|
assert_string_equal("\"a\"", match = vle_compl_next()); |
| 37 |
31 |
free(match); |
free(match); |
| 38 |
32 |
|
|
| 39 |
33 |
vle_compl_set_add_path_hook(NULL); |
vle_compl_set_add_path_hook(NULL); |
| |
| ... |
... |
TEST(set_add_path_hook_sets_hook) |
| 41 |
35 |
|
|
| 42 |
36 |
TEST(set_add_path_hook_resets_hook) |
TEST(set_add_path_hook_resets_hook) |
| 43 |
37 |
{ |
{ |
| 44 |
|
char *match; |
|
| 45 |
|
|
|
| 46 |
38 |
vle_compl_set_add_path_hook(&add_dquotes); |
vle_compl_set_add_path_hook(&add_dquotes); |
| 47 |
39 |
assert_int_equal(0, vle_compl_add_path_match("a b")); |
assert_int_equal(0, vle_compl_add_path_match("a b")); |
| 48 |
40 |
assert_int_equal(0, vle_compl_add_path_match("x y")); |
assert_int_equal(0, vle_compl_add_path_match("x y")); |
| |
| ... |
... |
TEST(set_add_path_hook_resets_hook) |
| 53 |
45 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 54 |
46 |
assert_int_equal(3, vle_compl_get_count()); |
assert_int_equal(3, vle_compl_get_count()); |
| 55 |
47 |
|
|
| 56 |
|
match = vle_compl_next(); |
|
| 57 |
|
assert_string_equal("\"a b\"", match); |
|
|
48 |
|
char *match; |
|
49 |
|
assert_string_equal("\"a b\"", match = vle_compl_next()); |
| 58 |
50 |
free(match); |
free(match); |
| 59 |
|
|
|
| 60 |
|
match = vle_compl_next(); |
|
| 61 |
|
assert_string_equal("\"x y\"", match); |
|
|
51 |
|
assert_string_equal("\"x y\"", match = vle_compl_next()); |
| 62 |
52 |
free(match); |
free(match); |
| 63 |
|
|
|
| 64 |
|
match = vle_compl_next(); |
|
| 65 |
|
assert_string_equal("a b c", match); |
|
|
53 |
|
assert_string_equal("a b c", match = vle_compl_next()); |
| 66 |
54 |
free(match); |
free(match); |
| 67 |
55 |
} |
} |
| 68 |
56 |
|
|
| 69 |
57 |
TEST(last_match_is_pre_processed) |
TEST(last_match_is_pre_processed) |
| 70 |
58 |
{ |
{ |
| 71 |
|
char *match; |
|
| 72 |
|
|
|
| 73 |
59 |
vle_compl_set_add_path_hook(&add_dquotes); |
vle_compl_set_add_path_hook(&add_dquotes); |
| 74 |
60 |
assert_int_equal(0, vle_compl_add_path_match("a b")); |
assert_int_equal(0, vle_compl_add_path_match("a b")); |
| 75 |
61 |
assert_int_equal(0, vle_compl_add_path_match("a b c")); |
assert_int_equal(0, vle_compl_add_path_match("a b c")); |
| |
| ... |
... |
TEST(last_match_is_pre_processed) |
| 78 |
64 |
|
|
| 79 |
65 |
assert_int_equal(3, vle_compl_get_count()); |
assert_int_equal(3, vle_compl_get_count()); |
| 80 |
66 |
|
|
| 81 |
|
match = vle_compl_next(); |
|
| 82 |
|
assert_string_equal("\"a b c\"", match); |
|
|
67 |
|
char *match; |
|
68 |
|
assert_string_equal("\"a b c\"", match = vle_compl_next()); |
| 83 |
69 |
free(match); |
free(match); |
| 84 |
|
|
|
| 85 |
|
match = vle_compl_next(); |
|
| 86 |
|
assert_string_equal("\"a b\"", match); |
|
|
70 |
|
assert_string_equal("\"a b\"", match = vle_compl_next()); |
| 87 |
71 |
free(match); |
free(match); |
| 88 |
|
|
|
| 89 |
|
match = vle_compl_next(); |
|
| 90 |
|
assert_string_equal("\"a\"", match); |
|
|
72 |
|
assert_string_equal("\"a\"", match = vle_compl_next()); |
| 91 |
73 |
free(match); |
free(match); |
| 92 |
74 |
} |
} |
| 93 |
75 |
|
|
| 94 |
76 |
TEST(set_add_path_hook_does_not_affect_non_path_functions) |
TEST(set_add_path_hook_does_not_affect_non_path_functions) |
| 95 |
77 |
{ |
{ |
| 96 |
|
char *match; |
|
| 97 |
|
|
|
| 98 |
78 |
vle_compl_set_add_path_hook(&add_dquotes); |
vle_compl_set_add_path_hook(&add_dquotes); |
| 99 |
79 |
assert_int_equal(0, vle_compl_add_match("a b", "")); |
assert_int_equal(0, vle_compl_add_match("a b", "")); |
| 100 |
80 |
assert_int_equal(0, vle_compl_add_match("a b c", "")); |
assert_int_equal(0, vle_compl_add_match("a b c", "")); |
| |
| ... |
... |
TEST(set_add_path_hook_does_not_affect_non_path_functions) |
| 103 |
83 |
|
|
| 104 |
84 |
assert_int_equal(3, vle_compl_get_count()); |
assert_int_equal(3, vle_compl_get_count()); |
| 105 |
85 |
|
|
| 106 |
|
match = vle_compl_next(); |
|
| 107 |
|
assert_string_equal("a b", match); |
|
|
86 |
|
char *match; |
|
87 |
|
assert_string_equal("a b", match = vle_compl_next()); |
| 108 |
88 |
free(match); |
free(match); |
| 109 |
|
|
|
| 110 |
|
match = vle_compl_next(); |
|
| 111 |
|
assert_string_equal("a b c", match); |
|
|
89 |
|
assert_string_equal("a b c", match = vle_compl_next()); |
| 112 |
90 |
free(match); |
free(match); |
| 113 |
|
|
|
| 114 |
|
match = vle_compl_next(); |
|
| 115 |
|
assert_string_equal("a", match); |
|
|
91 |
|
assert_string_equal("a", match = vle_compl_next()); |
| 116 |
92 |
free(match); |
free(match); |
| 117 |
93 |
} |
} |
| 118 |
94 |
|
|
| File tests/completion/completion.c changed (mode: 100644) (index 27f12789e..143b0baa6) |
| ... |
... |
SETUP_ONCE() |
| 16 |
16 |
|
|
| 17 |
17 |
TEST(general) |
TEST(general) |
| 18 |
18 |
{ |
{ |
| 19 |
|
char *buf; |
|
| 20 |
|
|
|
| 21 |
19 |
assert_int_equal(0, vle_compl_add_match("abc", "first")); |
assert_int_equal(0, vle_compl_add_match("abc", "first")); |
| 22 |
20 |
assert_int_equal(0, vle_compl_add_match("acd", "second")); |
assert_int_equal(0, vle_compl_add_match("acd", "second")); |
| 23 |
21 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 24 |
|
|
|
| 25 |
22 |
assert_int_equal(0, vle_compl_add_last_match("a")); |
assert_int_equal(0, vle_compl_add_last_match("a")); |
| 26 |
23 |
|
|
| 27 |
24 |
assert_int_equal(3, vle_compl_get_count()); |
assert_int_equal(3, vle_compl_get_count()); |
| |
| ... |
... |
TEST(general) |
| 32 |
29 |
assert_string_equal("a", vle_compl_get_items()[2].text); |
assert_string_equal("a", vle_compl_get_items()[2].text); |
| 33 |
30 |
assert_string_equal("", vle_compl_get_items()[2].descr); |
assert_string_equal("", vle_compl_get_items()[2].descr); |
| 34 |
31 |
|
|
|
32 |
|
char *buf; |
|
33 |
|
|
| 35 |
34 |
assert_int_equal(-1, vle_compl_get_pos()); |
assert_int_equal(-1, vle_compl_get_pos()); |
| 36 |
|
buf = vle_compl_next(); |
|
| 37 |
|
assert_string_equal("abc", buf); |
|
|
35 |
|
assert_string_equal("abc", buf = vle_compl_next()); |
| 38 |
36 |
free(buf); |
free(buf); |
| 39 |
37 |
|
|
| 40 |
38 |
assert_int_equal(0, vle_compl_get_pos()); |
assert_int_equal(0, vle_compl_get_pos()); |
| 41 |
|
buf = vle_compl_next(); |
|
| 42 |
|
assert_string_equal("acd", buf); |
|
|
39 |
|
assert_string_equal("acd", buf = vle_compl_next()); |
| 43 |
40 |
free(buf); |
free(buf); |
| 44 |
41 |
|
|
| 45 |
42 |
assert_int_equal(1, vle_compl_get_pos()); |
assert_int_equal(1, vle_compl_get_pos()); |
| 46 |
|
buf = vle_compl_next(); |
|
| 47 |
|
assert_string_equal("a", buf); |
|
|
43 |
|
assert_string_equal("a", buf = vle_compl_next()); |
| 48 |
44 |
free(buf); |
free(buf); |
| 49 |
45 |
|
|
| 50 |
46 |
assert_int_equal(2, vle_compl_get_pos()); |
assert_int_equal(2, vle_compl_get_pos()); |
| 51 |
|
buf = vle_compl_next(); |
|
| 52 |
|
assert_string_equal("abc", buf); |
|
|
47 |
|
assert_string_equal("abc", buf = vle_compl_next()); |
| 53 |
48 |
free(buf); |
free(buf); |
| 54 |
49 |
|
|
| 55 |
50 |
assert_int_equal(0, vle_compl_get_pos()); |
assert_int_equal(0, vle_compl_get_pos()); |
| 56 |
|
buf = vle_compl_next(); |
|
| 57 |
|
assert_string_equal("acd", buf); |
|
|
51 |
|
assert_string_equal("acd", buf = vle_compl_next()); |
| 58 |
52 |
free(buf); |
free(buf); |
| 59 |
53 |
} |
} |
| 60 |
54 |
|
|
| 61 |
55 |
TEST(sorting) |
TEST(sorting) |
| 62 |
56 |
{ |
{ |
| 63 |
|
char *buf; |
|
| 64 |
|
|
|
| 65 |
57 |
assert_int_equal(0, vle_compl_add_match("acd", "")); |
assert_int_equal(0, vle_compl_add_match("acd", "")); |
| 66 |
58 |
assert_int_equal(0, vle_compl_add_match("abc", "")); |
assert_int_equal(0, vle_compl_add_match("abc", "")); |
| 67 |
59 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 68 |
|
|
|
| 69 |
60 |
assert_int_equal(0, vle_compl_add_last_match("a")); |
assert_int_equal(0, vle_compl_add_last_match("a")); |
| 70 |
61 |
|
|
| 71 |
|
buf = vle_compl_next(); |
|
| 72 |
|
assert_string_equal("abc", buf); |
|
|
62 |
|
char *buf; |
|
63 |
|
assert_string_equal("abc", buf = vle_compl_next()); |
| 73 |
64 |
free(buf); |
free(buf); |
| 74 |
|
buf = vle_compl_next(); |
|
| 75 |
|
assert_string_equal("acd", buf); |
|
|
65 |
|
assert_string_equal("acd", buf = vle_compl_next()); |
| 76 |
66 |
free(buf); |
free(buf); |
| 77 |
|
buf = vle_compl_next(); |
|
| 78 |
|
assert_string_equal("a", buf); |
|
|
67 |
|
assert_string_equal("a", buf = vle_compl_next()); |
| 79 |
68 |
free(buf); |
free(buf); |
| 80 |
|
buf = vle_compl_next(); |
|
| 81 |
|
assert_string_equal("abc", buf); |
|
|
69 |
|
assert_string_equal("abc", buf = vle_compl_next()); |
| 82 |
70 |
free(buf); |
free(buf); |
| 83 |
71 |
} |
} |
| 84 |
72 |
|
|
| 85 |
73 |
TEST(custom_sorter) |
TEST(custom_sorter) |
| 86 |
74 |
{ |
{ |
| 87 |
|
char *buf; |
|
| 88 |
|
|
|
| 89 |
75 |
vle_compl_set_sorter(&reverse_sorter); |
vle_compl_set_sorter(&reverse_sorter); |
| 90 |
76 |
|
|
| 91 |
77 |
assert_int_equal(0, vle_compl_add_match("a", "")); |
assert_int_equal(0, vle_compl_add_match("a", "")); |
| 92 |
78 |
assert_int_equal(0, vle_compl_add_match("b", "")); |
assert_int_equal(0, vle_compl_add_match("b", "")); |
| 93 |
79 |
assert_int_equal(0, vle_compl_add_match("c", "")); |
assert_int_equal(0, vle_compl_add_match("c", "")); |
| 94 |
80 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 95 |
|
|
|
| 96 |
81 |
assert_int_equal(0, vle_compl_add_last_match("x")); |
assert_int_equal(0, vle_compl_add_last_match("x")); |
| 97 |
82 |
|
|
| 98 |
|
buf = vle_compl_next(); |
|
| 99 |
|
assert_string_equal("c", buf); |
|
|
83 |
|
char *buf; |
|
84 |
|
|
|
85 |
|
assert_string_equal("c", buf = vle_compl_next()); |
| 100 |
86 |
free(buf); |
free(buf); |
| 101 |
|
buf = vle_compl_next(); |
|
| 102 |
|
assert_string_equal("b", buf); |
|
|
87 |
|
assert_string_equal("b", buf = vle_compl_next()); |
| 103 |
88 |
free(buf); |
free(buf); |
| 104 |
|
buf = vle_compl_next(); |
|
| 105 |
|
assert_string_equal("a", buf); |
|
|
89 |
|
assert_string_equal("a", buf = vle_compl_next()); |
| 106 |
90 |
free(buf); |
free(buf); |
| 107 |
|
buf = vle_compl_next(); |
|
| 108 |
|
assert_string_equal("x", buf); |
|
|
91 |
|
assert_string_equal("x", buf = vle_compl_next()); |
| 109 |
92 |
free(buf); |
free(buf); |
| 110 |
93 |
|
|
| 111 |
|
buf = vle_compl_next(); |
|
| 112 |
|
assert_string_equal("c", buf); |
|
|
94 |
|
assert_string_equal("c", buf = vle_compl_next()); |
| 113 |
95 |
free(buf); |
free(buf); |
| 114 |
96 |
} |
} |
| 115 |
97 |
|
|
| 116 |
98 |
TEST(one_element_completion) |
TEST(one_element_completion) |
| 117 |
99 |
{ |
{ |
| 118 |
|
char *buf; |
|
| 119 |
|
|
|
| 120 |
100 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 121 |
|
|
|
| 122 |
101 |
assert_int_equal(0, vle_compl_add_match("a", "")); |
assert_int_equal(0, vle_compl_add_match("a", "")); |
| 123 |
102 |
|
|
| 124 |
|
buf = vle_compl_next(); |
|
| 125 |
|
assert_string_equal("a", buf); |
|
|
103 |
|
char *buf; |
|
104 |
|
|
|
105 |
|
assert_string_equal("a", buf = vle_compl_next()); |
| 126 |
106 |
free(buf); |
free(buf); |
| 127 |
|
buf = vle_compl_next(); |
|
| 128 |
|
assert_string_equal("a", buf); |
|
|
107 |
|
assert_string_equal("a", buf = vle_compl_next()); |
| 129 |
108 |
free(buf); |
free(buf); |
| 130 |
|
buf = vle_compl_next(); |
|
| 131 |
|
assert_string_equal("a", buf); |
|
|
109 |
|
assert_string_equal("a", buf = vle_compl_next()); |
| 132 |
110 |
free(buf); |
free(buf); |
| 133 |
|
buf = vle_compl_next(); |
|
| 134 |
|
assert_string_equal("a", buf); |
|
|
111 |
|
assert_string_equal("a", buf = vle_compl_next()); |
| 135 |
112 |
free(buf); |
free(buf); |
| 136 |
113 |
} |
} |
| 137 |
114 |
|
|
| 138 |
115 |
TEST(one_unambiguous_completion) |
TEST(one_unambiguous_completion) |
| 139 |
116 |
{ |
{ |
| 140 |
|
char *buf; |
|
| 141 |
|
|
|
| 142 |
117 |
assert_int_equal(0, vle_compl_add_match("abcd", "")); |
assert_int_equal(0, vle_compl_add_match("abcd", "")); |
| 143 |
118 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 144 |
|
|
|
| 145 |
119 |
assert_int_equal(0, vle_compl_add_last_match("a")); |
assert_int_equal(0, vle_compl_add_last_match("a")); |
| 146 |
120 |
|
|
| 147 |
|
buf = vle_compl_next(); |
|
| 148 |
|
assert_string_equal("abcd", buf); |
|
|
121 |
|
char *buf; |
|
122 |
|
|
|
123 |
|
assert_string_equal("abcd", buf = vle_compl_next()); |
| 149 |
124 |
free(buf); |
free(buf); |
| 150 |
|
buf = vle_compl_next(); |
|
| 151 |
|
assert_string_equal("abcd", buf); |
|
|
125 |
|
assert_string_equal("abcd", buf = vle_compl_next()); |
| 152 |
126 |
free(buf); |
free(buf); |
| 153 |
127 |
} |
} |
| 154 |
128 |
|
|
| 155 |
129 |
TEST(rewind_one_unambiguous_completion) |
TEST(rewind_one_unambiguous_completion) |
| 156 |
130 |
{ |
{ |
| 157 |
|
char *buf; |
|
| 158 |
|
|
|
| 159 |
131 |
assert_int_equal(0, vle_compl_add_match("abcd", "")); |
assert_int_equal(0, vle_compl_add_match("abcd", "")); |
| 160 |
132 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 161 |
|
|
|
| 162 |
133 |
assert_int_equal(0, vle_compl_add_last_match("a")); |
assert_int_equal(0, vle_compl_add_last_match("a")); |
| 163 |
134 |
|
|
| 164 |
|
buf = vle_compl_next(); |
|
| 165 |
|
assert_string_equal("abcd", buf); |
|
|
135 |
|
char *buf; |
|
136 |
|
|
|
137 |
|
assert_string_equal("abcd", buf = vle_compl_next()); |
| 166 |
138 |
free(buf); |
free(buf); |
| 167 |
|
buf = vle_compl_next(); |
|
| 168 |
|
assert_string_equal("abcd", buf); |
|
|
139 |
|
assert_string_equal("abcd", buf = vle_compl_next()); |
| 169 |
140 |
free(buf); |
free(buf); |
| 170 |
141 |
|
|
| 171 |
142 |
vle_compl_rewind(); |
vle_compl_rewind(); |
| 172 |
143 |
|
|
| 173 |
|
buf = vle_compl_next(); |
|
| 174 |
|
assert_string_equal("a", buf); |
|
|
144 |
|
assert_string_equal("a", buf = vle_compl_next()); |
| 175 |
145 |
free(buf); |
free(buf); |
| 176 |
|
buf = vle_compl_next(); |
|
| 177 |
|
assert_string_equal("abcd", buf); |
|
|
146 |
|
assert_string_equal("abcd", buf = vle_compl_next()); |
| 178 |
147 |
free(buf); |
free(buf); |
| 179 |
148 |
} |
} |
| 180 |
149 |
|
|
| 181 |
150 |
TEST(rewind_completion) |
TEST(rewind_completion) |
| 182 |
151 |
{ |
{ |
| 183 |
|
char *buf; |
|
| 184 |
|
|
|
| 185 |
152 |
assert_int_equal(0, vle_compl_add_match("acd", "")); |
assert_int_equal(0, vle_compl_add_match("acd", "")); |
| 186 |
153 |
assert_int_equal(0, vle_compl_add_match("abc", "")); |
assert_int_equal(0, vle_compl_add_match("abc", "")); |
| 187 |
154 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 188 |
|
|
|
| 189 |
155 |
assert_int_equal(0, vle_compl_add_last_match("a")); |
assert_int_equal(0, vle_compl_add_last_match("a")); |
| 190 |
156 |
|
|
| 191 |
|
buf = vle_compl_next(); |
|
| 192 |
|
assert_string_equal("abc", buf); |
|
|
157 |
|
char *buf; |
|
158 |
|
|
|
159 |
|
assert_string_equal("abc", buf = vle_compl_next()); |
| 193 |
160 |
free(buf); |
free(buf); |
| 194 |
161 |
|
|
| 195 |
162 |
vle_compl_rewind(); |
vle_compl_rewind(); |
| 196 |
163 |
free(vle_compl_next()); |
free(vle_compl_next()); |
| 197 |
164 |
|
|
| 198 |
|
buf = vle_compl_next(); |
|
| 199 |
|
assert_string_equal("abc", buf); |
|
|
165 |
|
assert_string_equal("abc", buf = vle_compl_next()); |
| 200 |
166 |
free(buf); |
free(buf); |
| 201 |
|
|
|
| 202 |
|
buf = vle_compl_next(); |
|
| 203 |
|
assert_string_equal("acd", buf); |
|
|
167 |
|
assert_string_equal("acd", buf = vle_compl_next()); |
| 204 |
168 |
free(buf); |
free(buf); |
| 205 |
169 |
|
|
| 206 |
170 |
vle_compl_rewind(); |
vle_compl_rewind(); |
| 207 |
171 |
free(vle_compl_next()); |
free(vle_compl_next()); |
| 208 |
172 |
|
|
| 209 |
|
buf = vle_compl_next(); |
|
| 210 |
|
assert_string_equal("abc", buf); |
|
|
173 |
|
assert_string_equal("abc", buf = vle_compl_next()); |
| 211 |
174 |
free(buf); |
free(buf); |
| 212 |
|
|
|
| 213 |
|
buf = vle_compl_next(); |
|
| 214 |
|
assert_string_equal("acd", buf); |
|
|
175 |
|
assert_string_equal("acd", buf = vle_compl_next()); |
| 215 |
176 |
free(buf); |
free(buf); |
| 216 |
|
|
|
| 217 |
|
buf = vle_compl_next(); |
|
| 218 |
|
assert_string_equal("a", buf); |
|
|
177 |
|
assert_string_equal("a", buf = vle_compl_next()); |
| 219 |
178 |
free(buf); |
free(buf); |
| 220 |
|
|
|
| 221 |
|
buf = vle_compl_next(); |
|
| 222 |
|
assert_string_equal("abc", buf); |
|
|
179 |
|
assert_string_equal("abc", buf = vle_compl_next()); |
| 223 |
180 |
free(buf); |
free(buf); |
| 224 |
181 |
} |
} |
| 225 |
182 |
|
|
| 226 |
183 |
TEST(direction) |
TEST(direction) |
| 227 |
184 |
{ |
{ |
| 228 |
|
char *buf; |
|
| 229 |
|
|
|
| 230 |
185 |
assert_int_equal(0, vle_compl_add_match("aa", "")); |
assert_int_equal(0, vle_compl_add_match("aa", "")); |
| 231 |
186 |
assert_int_equal(0, vle_compl_add_match("az", "")); |
assert_int_equal(0, vle_compl_add_match("az", "")); |
| 232 |
187 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 233 |
|
|
|
| 234 |
188 |
assert_int_equal(0, vle_compl_add_last_match("a")); |
assert_int_equal(0, vle_compl_add_last_match("a")); |
| 235 |
189 |
|
|
| 236 |
190 |
vle_compl_set_reversed(1); |
vle_compl_set_reversed(1); |
| 237 |
191 |
|
|
| 238 |
|
buf = vle_compl_next(); |
|
| 239 |
|
assert_string_equal("az", buf); |
|
|
192 |
|
char *buf; |
|
193 |
|
assert_string_equal("az", buf = vle_compl_next()); |
| 240 |
194 |
free(buf); |
free(buf); |
| 241 |
|
|
|
| 242 |
|
buf = vle_compl_next(); |
|
| 243 |
|
assert_string_equal("aa", buf); |
|
|
195 |
|
assert_string_equal("aa", buf = vle_compl_next()); |
| 244 |
196 |
free(buf); |
free(buf); |
| 245 |
|
|
|
| 246 |
|
buf = vle_compl_next(); |
|
| 247 |
|
assert_string_equal("a", buf); |
|
|
197 |
|
assert_string_equal("a", buf = vle_compl_next()); |
| 248 |
198 |
free(buf); |
free(buf); |
| 249 |
199 |
} |
} |
| 250 |
200 |
|
|
| 251 |
201 |
TEST(umbiguous_begin) |
TEST(umbiguous_begin) |
| 252 |
202 |
{ |
{ |
| 253 |
|
char *buf; |
|
| 254 |
|
|
|
| 255 |
203 |
assert_int_equal(0, vle_compl_add_match("sort", "")); |
assert_int_equal(0, vle_compl_add_match("sort", "")); |
| 256 |
204 |
assert_int_equal(0, vle_compl_add_match("sortorder", "")); |
assert_int_equal(0, vle_compl_add_match("sortorder", "")); |
| 257 |
205 |
assert_int_equal(0, vle_compl_add_match("sortnumbers", "")); |
assert_int_equal(0, vle_compl_add_match("sortnumbers", "")); |
| 258 |
206 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 259 |
|
|
|
| 260 |
207 |
assert_int_equal(0, vle_compl_add_last_match("sort")); |
assert_int_equal(0, vle_compl_add_last_match("sort")); |
| 261 |
208 |
|
|
| 262 |
|
buf = vle_compl_next(); |
|
| 263 |
|
assert_string_equal("sort", buf); |
|
|
209 |
|
char *buf; |
|
210 |
|
assert_string_equal("sort", buf = vle_compl_next()); |
| 264 |
211 |
free(buf); |
free(buf); |
| 265 |
|
|
|
| 266 |
|
buf = vle_compl_next(); |
|
| 267 |
|
assert_string_equal("sortnumbers", buf); |
|
|
212 |
|
assert_string_equal("sortnumbers", buf = vle_compl_next()); |
| 268 |
213 |
free(buf); |
free(buf); |
| 269 |
|
|
|
| 270 |
|
buf = vle_compl_next(); |
|
| 271 |
|
assert_string_equal("sortorder", buf); |
|
|
214 |
|
assert_string_equal("sortorder", buf = vle_compl_next()); |
| 272 |
215 |
free(buf); |
free(buf); |
| 273 |
|
|
|
| 274 |
|
buf = vle_compl_next(); |
|
| 275 |
|
assert_string_equal("sort", buf); |
|
|
216 |
|
assert_string_equal("sort", buf = vle_compl_next()); |
| 276 |
217 |
free(buf); |
free(buf); |
| 277 |
|
|
|
| 278 |
|
buf = vle_compl_next(); |
|
| 279 |
|
assert_string_equal("sort", buf); |
|
|
218 |
|
assert_string_equal("sort", buf = vle_compl_next()); |
| 280 |
219 |
free(buf); |
free(buf); |
| 281 |
220 |
} |
} |
| 282 |
221 |
|
|
| 283 |
222 |
TEST(two_matches) |
TEST(two_matches) |
| 284 |
223 |
{ |
{ |
| 285 |
|
char *buf; |
|
| 286 |
|
|
|
| 287 |
224 |
assert_int_equal(0, vle_compl_add_match("mountpoint", "")); |
assert_int_equal(0, vle_compl_add_match("mountpoint", "")); |
| 288 |
225 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 289 |
226 |
assert_int_equal(0, vle_compl_add_match("mount", "")); |
assert_int_equal(0, vle_compl_add_match("mount", "")); |
| 290 |
227 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 291 |
|
|
|
| 292 |
228 |
assert_int_equal(0, vle_compl_add_last_match("mount")); |
assert_int_equal(0, vle_compl_add_last_match("mount")); |
| 293 |
229 |
|
|
| 294 |
|
buf = vle_compl_next(); |
|
| 295 |
|
assert_string_equal("mountpoint", buf); |
|
|
230 |
|
char *buf; |
|
231 |
|
assert_string_equal("mountpoint", buf = vle_compl_next()); |
| 296 |
232 |
free(buf); |
free(buf); |
| 297 |
|
|
|
| 298 |
|
buf = vle_compl_next(); |
|
| 299 |
|
assert_string_equal("mount", buf); |
|
|
233 |
|
assert_string_equal("mount", buf = vle_compl_next()); |
| 300 |
234 |
free(buf); |
free(buf); |
| 301 |
|
|
|
| 302 |
|
buf = vle_compl_next(); |
|
| 303 |
|
assert_string_equal("mount", buf); |
|
|
235 |
|
assert_string_equal("mount", buf = vle_compl_next()); |
| 304 |
236 |
free(buf); |
free(buf); |
| 305 |
|
|
|
| 306 |
|
buf = vle_compl_next(); |
|
| 307 |
|
assert_string_equal("mountpoint", buf); |
|
|
237 |
|
assert_string_equal("mountpoint", buf = vle_compl_next()); |
| 308 |
238 |
free(buf); |
free(buf); |
| 309 |
239 |
} |
} |
| 310 |
240 |
|
|
| 311 |
241 |
TEST(removes_duplicates) |
TEST(removes_duplicates) |
| 312 |
242 |
{ |
{ |
| 313 |
|
char *buf; |
|
| 314 |
|
|
|
| 315 |
243 |
assert_int_equal(0, vle_compl_add_match("mou", "")); |
assert_int_equal(0, vle_compl_add_match("mou", "")); |
| 316 |
244 |
assert_int_equal(0, vle_compl_add_match("mount", "")); |
assert_int_equal(0, vle_compl_add_match("mount", "")); |
| 317 |
245 |
assert_int_equal(0, vle_compl_add_match("mount", "")); |
assert_int_equal(0, vle_compl_add_match("mount", "")); |
| 318 |
246 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 319 |
|
|
|
| 320 |
247 |
assert_int_equal(0, vle_compl_add_last_match("m")); |
assert_int_equal(0, vle_compl_add_last_match("m")); |
| 321 |
248 |
|
|
| 322 |
|
buf = vle_compl_next(); |
|
| 323 |
|
assert_string_equal("mou", buf); |
|
|
249 |
|
char *buf; |
|
250 |
|
assert_string_equal("mou", buf = vle_compl_next()); |
| 324 |
251 |
free(buf); |
free(buf); |
| 325 |
|
|
|
| 326 |
|
buf = vle_compl_next(); |
|
| 327 |
|
assert_string_equal("mount", buf); |
|
|
252 |
|
assert_string_equal("mount", buf = vle_compl_next()); |
| 328 |
253 |
free(buf); |
free(buf); |
| 329 |
|
|
|
| 330 |
|
buf = vle_compl_next(); |
|
| 331 |
|
assert_string_equal("m", buf); |
|
|
254 |
|
assert_string_equal("m", buf = vle_compl_next()); |
| 332 |
255 |
free(buf); |
free(buf); |
| 333 |
|
|
|
| 334 |
|
buf = vle_compl_next(); |
|
| 335 |
|
assert_string_equal("mou", buf); |
|
|
256 |
|
assert_string_equal("mou", buf = vle_compl_next()); |
| 336 |
257 |
free(buf); |
free(buf); |
| 337 |
258 |
} |
} |
| 338 |
259 |
|
|
| |
| ... |
... |
TEST(longest_completion) |
| 344 |
265 |
assert_int_equal(0, vle_compl_add_match("vifm.lua", "")); |
assert_int_equal(0, vle_compl_add_match("vifm.lua", "")); |
| 345 |
266 |
assert_int_equal(0, vle_compl_add_match("vifm.vim", "")); |
assert_int_equal(0, vle_compl_add_match("vifm.vim", "")); |
| 346 |
267 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 347 |
|
|
|
| 348 |
268 |
assert_int_equal(0, vle_compl_add_last_match("v")); |
assert_int_equal(0, vle_compl_add_last_match("v")); |
| 349 |
269 |
|
|
| 350 |
270 |
char *buf; |
char *buf; |
| |
| ... |
... |
TEST(unicode_sorting, IF(utf8_locale)) |
| 387 |
307 |
vle_compl_finish_group(); |
vle_compl_finish_group(); |
| 388 |
308 |
|
|
| 389 |
309 |
char *buf; |
char *buf; |
| 390 |
|
|
|
| 391 |
|
buf = vle_compl_next(); |
|
| 392 |
|
assert_string_equal("A", buf); |
|
|
310 |
|
assert_string_equal("A", buf = vle_compl_next()); |
| 393 |
311 |
free(buf); |
free(buf); |
| 394 |
|
buf = vle_compl_next(); |
|
| 395 |
|
assert_string_equal("Ö", buf); |
|
|
312 |
|
assert_string_equal("Ö", buf = vle_compl_next()); |
| 396 |
313 |
free(buf); |
free(buf); |
| 397 |
|
buf = vle_compl_next(); |
|
| 398 |
|
assert_string_equal("a", buf); |
|
|
314 |
|
assert_string_equal("a", buf = vle_compl_next()); |
| 399 |
315 |
free(buf); |
free(buf); |
| 400 |
|
buf = vle_compl_next(); |
|
| 401 |
|
assert_string_equal("ö", buf); |
|
|
316 |
|
assert_string_equal("ö", buf = vle_compl_next()); |
| 402 |
317 |
free(buf); |
free(buf); |
| 403 |
|
buf = vle_compl_next(); |
|
| 404 |
|
assert_string_equal(compounds, buf); |
|
|
318 |
|
assert_string_equal(compounds, buf = vle_compl_next()); |
| 405 |
319 |
free(buf); |
free(buf); |
| 406 |
|
buf = vle_compl_next(); |
|
| 407 |
|
assert_string_equal(non_compounds, buf); |
|
|
320 |
|
assert_string_equal(non_compounds, buf = vle_compl_next()); |
| 408 |
321 |
free(buf); |
free(buf); |
| 409 |
|
buf = vle_compl_next(); |
|
| 410 |
|
assert_string_equal("p", buf); |
|
|
322 |
|
assert_string_equal("p", buf = vle_compl_next()); |
| 411 |
323 |
free(buf); |
free(buf); |
| 412 |
324 |
} |
} |
| 413 |
325 |
|
|