File tests/fileops/cpmv_files.c changed (mode: 100644) (index ecac7af4e..2faa158a6) |
... |
... |
SETUP() |
24 |
24 |
saved_cwd = save_cwd(); |
saved_cwd = save_cwd(); |
25 |
25 |
assert_success(chdir(SANDBOX_PATH)); |
assert_success(chdir(SANDBOX_PATH)); |
26 |
26 |
|
|
27 |
|
/* lwin */ |
|
28 |
|
strcpy(lwin.curr_dir, SANDBOX_PATH); |
|
|
27 |
|
if(is_path_absolute(SANDBOX_PATH)) |
|
28 |
|
{ |
|
29 |
|
strcpy(lwin.curr_dir, SANDBOX_PATH); |
|
30 |
|
strcpy(rwin.curr_dir, SANDBOX_PATH); |
|
31 |
|
} |
|
32 |
|
else |
|
33 |
|
{ |
|
34 |
|
snprintf(lwin.curr_dir, sizeof(lwin.curr_dir), "%s/%s", saved_cwd, |
|
35 |
|
SANDBOX_PATH); |
|
36 |
|
snprintf(rwin.curr_dir, sizeof(lwin.curr_dir), "%s/%s", saved_cwd, |
|
37 |
|
SANDBOX_PATH); |
|
38 |
|
} |
29 |
39 |
|
|
|
40 |
|
/* lwin */ |
30 |
41 |
lwin.list_rows = 1; |
lwin.list_rows = 1; |
31 |
42 |
lwin.list_pos = 0; |
lwin.list_pos = 0; |
32 |
43 |
lwin.dir_entry = dynarray_cextend(NULL, |
lwin.dir_entry = dynarray_cextend(NULL, |
|
... |
... |
SETUP() |
35 |
46 |
lwin.dir_entry[0].origin = &lwin.curr_dir[0]; |
lwin.dir_entry[0].origin = &lwin.curr_dir[0]; |
36 |
47 |
|
|
37 |
48 |
/* rwin */ |
/* rwin */ |
38 |
|
strcpy(rwin.curr_dir, SANDBOX_PATH); |
|
39 |
|
|
|
40 |
49 |
rwin.list_rows = 0; |
rwin.list_rows = 0; |
41 |
50 |
rwin.filtered = 0; |
rwin.filtered = 0; |
42 |
51 |
rwin.list_pos = 0; |
rwin.list_pos = 0; |
|
... |
... |
TEST(refuse_to_copy_or_move_to_source_files_with_the_same_name) |
133 |
142 |
restore_cwd(saved_cwd); |
restore_cwd(saved_cwd); |
134 |
143 |
saved_cwd = save_cwd(); |
saved_cwd = save_cwd(); |
135 |
144 |
|
|
|
145 |
|
strcpy(rwin.curr_dir, saved_cwd); |
136 |
146 |
flist_custom_start(&rwin, "test"); |
flist_custom_start(&rwin, "test"); |
137 |
147 |
flist_custom_add(&rwin, TEST_DATA_PATH "/existing-files/a"); |
flist_custom_add(&rwin, TEST_DATA_PATH "/existing-files/a"); |
138 |
148 |
flist_custom_add(&rwin, TEST_DATA_PATH "/rename/a"); |
flist_custom_add(&rwin, TEST_DATA_PATH "/rename/a"); |
139 |
149 |
assert_true(flist_custom_finish(&rwin, 0) == 0); |
assert_true(flist_custom_finish(&rwin, 0) == 0); |
|
150 |
|
assert_int_equal(2, rwin.list_rows); |
140 |
151 |
|
|
141 |
152 |
assert_success(chdir(SANDBOX_PATH)); |
assert_success(chdir(SANDBOX_PATH)); |
142 |
153 |
|
|
|
... |
... |
TEST(cpmv_crash_on_wrong_list_access) |
166 |
177 |
restore_cwd(saved_cwd); |
restore_cwd(saved_cwd); |
167 |
178 |
saved_cwd = save_cwd(); |
saved_cwd = save_cwd(); |
168 |
179 |
|
|
169 |
|
strcpy(lwin.curr_dir, TEST_DATA_PATH "/existing-files"); |
|
170 |
|
strcpy(rwin.curr_dir, SANDBOX_PATH); |
|
|
180 |
|
if(is_path_absolute(TEST_DATA_PATH)) |
|
181 |
|
{ |
|
182 |
|
snprintf(lwin.curr_dir, sizeof(lwin.curr_dir), "%s/existing-files", |
|
183 |
|
TEST_DATA_PATH); |
|
184 |
|
} |
|
185 |
|
else |
|
186 |
|
{ |
|
187 |
|
snprintf(lwin.curr_dir, sizeof(lwin.curr_dir), "%s/%s/existing-files", |
|
188 |
|
saved_cwd, TEST_DATA_PATH); |
|
189 |
|
} |
171 |
190 |
|
|
172 |
191 |
lwin.list_rows = 3; |
lwin.list_rows = 3; |
173 |
192 |
lwin.list_pos = 0; |
lwin.list_pos = 0; |
File tests/fileops/put_files.c changed (mode: 100644) (index 852d25c27..c53de23dc) |
5 |
5 |
|
|
6 |
6 |
#include <string.h> /* strcpy() */ |
#include <string.h> /* strcpy() */ |
7 |
7 |
|
|
|
8 |
|
#include "../../src/utils/fs.h" |
|
9 |
|
#include "../../src/utils/path.h" |
8 |
10 |
#include "../../src/fileops.h" |
#include "../../src/fileops.h" |
9 |
11 |
#include "../../src/registers.h" |
#include "../../src/registers.h" |
10 |
12 |
|
|
|
... |
... |
SETUP() |
19 |
21 |
{ |
{ |
20 |
22 |
regs_init(); |
regs_init(); |
21 |
23 |
|
|
22 |
|
strcpy(lwin.curr_dir, SANDBOX_PATH); |
|
|
24 |
|
if(is_path_absolute(SANDBOX_PATH)) |
|
25 |
|
{ |
|
26 |
|
strcpy(lwin.curr_dir, SANDBOX_PATH); |
|
27 |
|
} |
|
28 |
|
else |
|
29 |
|
{ |
|
30 |
|
char cwd[PATH_MAX]; |
|
31 |
|
assert_non_null(get_cwd(cwd, sizeof(cwd))); |
|
32 |
|
snprintf(lwin.curr_dir, sizeof(lwin.curr_dir), "%s/%s", cwd, SANDBOX_PATH); |
|
33 |
|
} |
23 |
34 |
} |
} |
24 |
35 |
|
|
25 |
36 |
TEARDOWN() |
TEARDOWN() |
|
... |
... |
TEST(put_files_bg_fails_on_identical_names_in_a_register) |
70 |
81 |
TEST(overwrite_request_accounts_for_target_file_rename) |
TEST(overwrite_request_accounts_for_target_file_rename) |
71 |
82 |
{ |
{ |
72 |
83 |
struct stat st; |
struct stat st; |
|
84 |
|
char src_file[PATH_MAX]; |
73 |
85 |
FILE *f; |
FILE *f; |
|
86 |
|
char *saved_cwd; |
74 |
87 |
|
|
75 |
88 |
f = fopen(SANDBOX_PATH "/binary-data", "w"); |
f = fopen(SANDBOX_PATH "/binary-data", "w"); |
76 |
89 |
fclose(f); |
fclose(f); |
|
... |
... |
TEST(overwrite_request_accounts_for_target_file_rename) |
78 |
91 |
f = fopen(SANDBOX_PATH "/b", "w"); |
f = fopen(SANDBOX_PATH "/b", "w"); |
79 |
92 |
fclose(f); |
fclose(f); |
80 |
93 |
|
|
81 |
|
assert_success(regs_append('a', TEST_DATA_PATH "/read/binary-data")); |
|
|
94 |
|
if(is_path_absolute(TEST_DATA_PATH)) |
|
95 |
|
{ |
|
96 |
|
snprintf(src_file, sizeof(src_file), "%s/read/binary-data", TEST_DATA_PATH); |
|
97 |
|
} |
|
98 |
|
else |
|
99 |
|
{ |
|
100 |
|
char cwd[PATH_MAX]; |
|
101 |
|
assert_non_null(get_cwd(cwd, sizeof(cwd))); |
|
102 |
|
snprintf(src_file, sizeof(src_file), "%s/%s/read/binary-data", cwd, |
|
103 |
|
TEST_DATA_PATH); |
|
104 |
|
} |
|
105 |
|
|
|
106 |
|
assert_success(regs_append('a', src_file)); |
82 |
107 |
|
|
83 |
108 |
init_fileops(&line_prompt, &options_prompt_rename); |
init_fileops(&line_prompt, &options_prompt_rename); |
84 |
109 |
|
|
|
110 |
|
saved_cwd = save_cwd(); |
85 |
111 |
(void)put_files(&lwin, 'a', 0); |
(void)put_files(&lwin, 'a', 0); |
|
112 |
|
restore_cwd(saved_cwd); |
86 |
113 |
|
|
87 |
114 |
assert_success(stat(SANDBOX_PATH "/binary-data", &st)); |
assert_success(stat(SANDBOX_PATH "/binary-data", &st)); |
88 |
115 |
assert_int_equal(0, st.st_size); |
assert_int_equal(0, st.st_size); |
File tests/misc/cmdline_completion.c changed (mode: 100644) (index ba732bb8b..e3ae167ea) |
25 |
25 |
#include "../../src/builtin_functions.h" |
#include "../../src/builtin_functions.h" |
26 |
26 |
#include "../../src/cmd_core.h" |
#include "../../src/cmd_core.h" |
27 |
27 |
|
|
|
28 |
|
#include "utils.h" |
|
29 |
|
|
28 |
30 |
#if defined(__CYGWIN__) || defined(_WIN32) |
#if defined(__CYGWIN__) || defined(_WIN32) |
29 |
31 |
#define SUFFIX ".exe" |
#define SUFFIX ".exe" |
30 |
32 |
#define SUFFIXW L".exe" |
#define SUFFIXW L".exe" |
|
35 |
37 |
|
|
36 |
38 |
static void dummy_handler(OPT_OP op, optval_t val); |
static void dummy_handler(OPT_OP op, optval_t val); |
37 |
39 |
static void create_executable(const char file[]); |
static void create_executable(const char file[]); |
38 |
|
static void create_file(const char file[]); |
|
39 |
40 |
static int dquotes_allowed_in_paths(void); |
static int dquotes_allowed_in_paths(void); |
40 |
41 |
static int not_windows(void); |
static int not_windows(void); |
41 |
42 |
|
|
|
... |
... |
SETUP() |
79 |
80 |
|
|
80 |
81 |
saved_cwd = save_cwd(); |
saved_cwd = save_cwd(); |
81 |
82 |
assert_success(chdir(TEST_DATA_PATH "/existing-files")); |
assert_success(chdir(TEST_DATA_PATH "/existing-files")); |
82 |
|
strcpy(curr_view->curr_dir, TEST_DATA_PATH "/existing-files"); |
|
|
83 |
|
make_abs_path(curr_view->curr_dir, sizeof(curr_view->curr_dir), |
|
84 |
|
TEST_DATA_PATH, "existing-files", saved_cwd); |
83 |
85 |
} |
} |
84 |
86 |
|
|
85 |
87 |
TEARDOWN() |
TEARDOWN() |
|
... |
... |
TEST(spaces_escaping_leading) |
173 |
175 |
{ |
{ |
174 |
176 |
char *mb; |
char *mb; |
175 |
177 |
|
|
176 |
|
assert_success(chdir(TEST_DATA_PATH "/spaces-in-names")); |
|
177 |
|
strcpy(curr_view->curr_dir, TEST_DATA_PATH "/spaces-in-names"); |
|
|
178 |
|
make_abs_path(curr_view->curr_dir, sizeof(curr_view->curr_dir), |
|
179 |
|
TEST_DATA_PATH, "spaces-in-names", saved_cwd); |
|
180 |
|
assert_success(chdir(curr_view->curr_dir)); |
178 |
181 |
|
|
179 |
182 |
prepare_for_line_completion(L"touch \\ "); |
prepare_for_line_completion(L"touch \\ "); |
180 |
183 |
assert_success(line_completion(&stats)); |
assert_success(line_completion(&stats)); |
|
... |
... |
TEST(spaces_escaping_trailing) |
212 |
215 |
{ |
{ |
213 |
216 |
char *mb; |
char *mb; |
214 |
217 |
|
|
215 |
|
assert_success(chdir(TEST_DATA_PATH "/spaces-in-names")); |
|
216 |
|
strcpy(curr_view->curr_dir, TEST_DATA_PATH "/spaces-in-names"); |
|
|
218 |
|
make_abs_path(curr_view->curr_dir, sizeof(curr_view->curr_dir), |
|
219 |
|
TEST_DATA_PATH, "spaces-in-names", saved_cwd); |
|
220 |
|
assert_success(chdir(curr_view->curr_dir)); |
217 |
221 |
|
|
218 |
222 |
prepare_for_line_completion(L"touch e"); |
prepare_for_line_completion(L"touch e"); |
219 |
223 |
assert_success(line_completion(&stats)); |
assert_success(line_completion(&stats)); |
|
... |
... |
TEST(spaces_escaping_middle) |
237 |
241 |
{ |
{ |
238 |
242 |
char *mb; |
char *mb; |
239 |
243 |
|
|
240 |
|
assert_success(chdir(TEST_DATA_PATH "/spaces-in-names")); |
|
241 |
|
strcpy(curr_view->curr_dir, TEST_DATA_PATH "/spaces-in-names"); |
|
|
244 |
|
make_abs_path(curr_view->curr_dir, sizeof(curr_view->curr_dir), |
|
245 |
|
TEST_DATA_PATH, "spaces-in-names", saved_cwd); |
|
246 |
|
assert_success(chdir(curr_view->curr_dir)); |
242 |
247 |
|
|
243 |
248 |
prepare_for_line_completion(L"touch s"); |
prepare_for_line_completion(L"touch s"); |
244 |
249 |
assert_success(line_completion(&stats)); |
assert_success(line_completion(&stats)); |
|
... |
... |
TEST(squoted_completion) |
257 |
262 |
|
|
258 |
263 |
TEST(squoted_completion_escaping) |
TEST(squoted_completion_escaping) |
259 |
264 |
{ |
{ |
260 |
|
assert_success(chdir(TEST_DATA_PATH "/quotes-in-names")); |
|
261 |
|
strcpy(curr_view->curr_dir, TEST_DATA_PATH "/quotes-in-names"); |
|
|
265 |
|
make_abs_path(curr_view->curr_dir, sizeof(curr_view->curr_dir), |
|
266 |
|
TEST_DATA_PATH, "quotes-in-names", saved_cwd); |
|
267 |
|
assert_success(chdir(curr_view->curr_dir)); |
262 |
268 |
|
|
263 |
269 |
prepare_for_line_completion(L"touch 's-quote"); |
prepare_for_line_completion(L"touch 's-quote"); |
264 |
270 |
assert_success(line_completion(&stats)); |
assert_success(line_completion(&stats)); |
|
... |
... |
TEST(last_match_is_properly_escaped) |
294 |
300 |
{ |
{ |
295 |
301 |
char *match; |
char *match; |
296 |
302 |
|
|
297 |
|
assert_success(chdir(TEST_DATA_PATH "/quotes-in-names")); |
|
298 |
|
strcpy(curr_view->curr_dir, TEST_DATA_PATH "/quotes-in-names"); |
|
|
303 |
|
make_abs_path(curr_view->curr_dir, sizeof(curr_view->curr_dir), |
|
304 |
|
TEST_DATA_PATH, "quotes-in-names", saved_cwd); |
|
305 |
|
assert_success(chdir(curr_view->curr_dir)); |
299 |
306 |
|
|
300 |
307 |
prepare_for_line_completion(L"touch 's-quote-''-in"); |
prepare_for_line_completion(L"touch 's-quote-''-in"); |
301 |
308 |
assert_success(line_completion(&stats)); |
assert_success(line_completion(&stats)); |
|
... |
... |
TEST(dirs_are_completed_with_trailing_slash) |
361 |
368 |
{ |
{ |
362 |
369 |
char *match; |
char *match; |
363 |
370 |
|
|
364 |
|
assert_success(chdir(TEST_DATA_PATH)); |
|
365 |
|
strcpy(curr_view->curr_dir, TEST_DATA_PATH); |
|
|
371 |
|
make_abs_path(curr_view->curr_dir, sizeof(curr_view->curr_dir), |
|
372 |
|
TEST_DATA_PATH, "", saved_cwd); |
|
373 |
|
assert_success(chdir(curr_view->curr_dir)); |
366 |
374 |
|
|
367 |
375 |
prepare_for_line_completion(L"cd r"); |
prepare_for_line_completion(L"cd r"); |
368 |
376 |
assert_success(line_completion(&stats)); |
assert_success(line_completion(&stats)); |
|
... |
... |
TEST(bang_abs_path_completion) |
504 |
512 |
|
|
505 |
513 |
TEST(tilde_is_completed_after_emark) |
TEST(tilde_is_completed_after_emark) |
506 |
514 |
{ |
{ |
507 |
|
strcpy(cfg.home_dir, TEST_DATA_PATH "/"); |
|
|
515 |
|
make_abs_path(cfg.home_dir, sizeof(cfg.home_dir), TEST_DATA_PATH, "", |
|
516 |
|
saved_cwd); |
508 |
517 |
|
|
509 |
518 |
prepare_for_line_completion(L"!~/"); |
prepare_for_line_completion(L"!~/"); |
510 |
519 |
assert_success(line_completion(&stats)); |
assert_success(line_completion(&stats)); |
|
... |
... |
TEST(bmark_path_is_completed) |
538 |
547 |
{ |
{ |
539 |
548 |
bmarks_clear(); |
bmarks_clear(); |
540 |
549 |
|
|
541 |
|
restore_cwd(saved_cwd); |
|
542 |
|
saved_cwd = save_cwd(); |
|
543 |
|
assert_success(chdir(SANDBOX_PATH)); |
|
544 |
|
strcpy(curr_view->curr_dir, SANDBOX_PATH); |
|
|
550 |
|
make_abs_path(curr_view->curr_dir, sizeof(curr_view->curr_dir), SANDBOX_PATH, |
|
551 |
|
"", saved_cwd); |
|
552 |
|
assert_success(chdir(curr_view->curr_dir)); |
545 |
553 |
create_executable("exec-for-completion" SUFFIX); |
create_executable("exec-for-completion" SUFFIX); |
546 |
554 |
|
|
547 |
555 |
prepare_for_line_completion(L"bmark! exec"); |
prepare_for_line_completion(L"bmark! exec"); |
|
... |
... |
TEST(selective_sync_completion) |
575 |
583 |
|
|
576 |
584 |
TEST(colorscheme_completion) |
TEST(colorscheme_completion) |
577 |
585 |
{ |
{ |
578 |
|
strcpy(cfg.colors_dir, TEST_DATA_PATH "/scripts/"); |
|
|
586 |
|
make_abs_path(cfg.colors_dir, sizeof(cfg.colors_dir), TEST_DATA_PATH, |
|
587 |
|
"scripts", saved_cwd); |
579 |
588 |
|
|
580 |
589 |
prepare_for_line_completion(L"colorscheme set-"); |
prepare_for_line_completion(L"colorscheme set-"); |
581 |
590 |
assert_success(line_completion(&stats)); |
assert_success(line_completion(&stats)); |
|
... |
... |
TEST(colorscheme_completion) |
589 |
598 |
assert_success(line_completion(&stats)); |
assert_success(line_completion(&stats)); |
590 |
599 |
assert_wstring_equal(L"colorscheme ../", stats.line); |
assert_wstring_equal(L"colorscheme ../", stats.line); |
591 |
600 |
|
|
592 |
|
strcpy(curr_view->curr_dir, TEST_DATA_PATH); |
|
|
601 |
|
make_abs_path(curr_view->curr_dir, sizeof(curr_view->curr_dir), |
|
602 |
|
TEST_DATA_PATH, "", saved_cwd); |
593 |
603 |
prepare_for_line_completion(L"colorscheme set-env "); |
prepare_for_line_completion(L"colorscheme set-env "); |
594 |
604 |
assert_success(line_completion(&stats)); |
assert_success(line_completion(&stats)); |
595 |
605 |
assert_wstring_equal(L"colorscheme set-env existing-files/", stats.line); |
assert_wstring_equal(L"colorscheme set-env existing-files/", stats.line); |
|
... |
... |
TEST(grep_completion) |
616 |
626 |
assert_success(line_completion(&stats)); |
assert_success(line_completion(&stats)); |
617 |
627 |
assert_wstring_equal(L"grep -o ../", stats.line); |
assert_wstring_equal(L"grep -o ../", stats.line); |
618 |
628 |
|
|
619 |
|
strcpy(curr_view->curr_dir, TEST_DATA_PATH); |
|
|
629 |
|
make_abs_path(curr_view->curr_dir, sizeof(curr_view->curr_dir), |
|
630 |
|
TEST_DATA_PATH, "", saved_cwd); |
620 |
631 |
prepare_for_line_completion(L"grep -o "); |
prepare_for_line_completion(L"grep -o "); |
621 |
632 |
assert_success(line_completion(&stats)); |
assert_success(line_completion(&stats)); |
622 |
633 |
assert_wstring_equal(L"grep -o existing-files/", stats.line); |
assert_wstring_equal(L"grep -o existing-files/", stats.line); |
|
... |
... |
TEST(find_completion) |
632 |
643 |
assert_success(line_completion(&stats)); |
assert_success(line_completion(&stats)); |
633 |
644 |
assert_wstring_equal(L"find . .", stats.line); |
assert_wstring_equal(L"find . .", stats.line); |
634 |
645 |
|
|
635 |
|
strcpy(curr_view->curr_dir, TEST_DATA_PATH); |
|
|
646 |
|
make_abs_path(curr_view->curr_dir, sizeof(curr_view->curr_dir), |
|
647 |
|
TEST_DATA_PATH, "", saved_cwd); |
636 |
648 |
prepare_for_line_completion(L"find "); |
prepare_for_line_completion(L"find "); |
637 |
649 |
assert_success(line_completion(&stats)); |
assert_success(line_completion(&stats)); |
638 |
650 |
assert_wstring_equal(L"find existing-files/", stats.line); |
assert_wstring_equal(L"find existing-files/", stats.line); |
|
... |
... |
create_executable(const char file[]) |
769 |
781 |
assert_success(access(file, X_OK)); |
assert_success(access(file, X_OK)); |
770 |
782 |
} |
} |
771 |
783 |
|
|
772 |
|
static void |
|
773 |
|
create_file(const char file[]) |
|
774 |
|
{ |
|
775 |
|
FILE *const f = fopen(file, "w"); |
|
776 |
|
assert_non_null(f); |
|
777 |
|
if(f != NULL) |
|
778 |
|
{ |
|
779 |
|
fclose(f); |
|
780 |
|
} |
|
781 |
|
} |
|
782 |
|
|
|
783 |
784 |
static int |
static int |
784 |
785 |
dquotes_allowed_in_paths(void) |
dquotes_allowed_in_paths(void) |
785 |
786 |
{ |
{ |
File tests/misc/flist_custom.c changed (mode: 100644) (index 23008e285..b55552a0a) |
... |
... |
SETUP() |
67 |
67 |
|
|
68 |
68 |
curr_view = &lwin; |
curr_view = &lwin; |
69 |
69 |
other_view = &lwin; |
other_view = &lwin; |
|
70 |
|
|
|
71 |
|
snprintf(lwin.curr_dir, sizeof(lwin.curr_dir), "%s/..", test_data); |
70 |
72 |
} |
} |
71 |
73 |
|
|
72 |
74 |
TEARDOWN() |
TEARDOWN() |
|
... |
... |
TEST(files_are_sorted_undecorated) |
273 |
275 |
assert_success(os_mkdir("foo-", 0700)); |
assert_success(os_mkdir("foo-", 0700)); |
274 |
276 |
assert_success(os_mkdir("foo0", 0700)); |
assert_success(os_mkdir("foo0", 0700)); |
275 |
277 |
|
|
276 |
|
copy_str(lwin.curr_dir, sizeof(lwin.curr_dir), SANDBOX_PATH); |
|
|
278 |
|
assert_true(get_cwd(lwin.curr_dir, sizeof(lwin.curr_dir)) == lwin.curr_dir); |
277 |
279 |
assert_false(flist_custom_active(&lwin)); |
assert_false(flist_custom_active(&lwin)); |
278 |
280 |
flist_custom_start(&lwin, "test"); |
flist_custom_start(&lwin, "test"); |
279 |
281 |
flist_custom_add(&lwin, "foo"); |
flist_custom_add(&lwin, "foo"); |
|
... |
... |
TEST(can_set_very_cv_twice_in_a_row) |
517 |
519 |
|
|
518 |
520 |
setup_custom_view(&lwin, 1); |
setup_custom_view(&lwin, 1); |
519 |
521 |
flist_custom_start(&lwin, "test"); |
flist_custom_start(&lwin, "test"); |
520 |
|
flist_custom_add(&lwin, TEST_DATA_PATH "/existing-files/a"); |
|
|
522 |
|
flist_custom_add(&lwin, "a"); |
521 |
523 |
assert_true(flist_custom_finish(&lwin, 1) == 0); |
assert_true(flist_custom_finish(&lwin, 1) == 0); |
522 |
524 |
|
|
523 |
525 |
columns_free(lwin.columns); |
columns_free(lwin.columns); |
|
... |
... |
TEST(can_set_very_cv_twice_in_a_row) |
529 |
531 |
|
|
530 |
532 |
TEST(renaming_dir_in_cv_adjust_its_children_entries) |
TEST(renaming_dir_in_cv_adjust_its_children_entries) |
531 |
533 |
{ |
{ |
532 |
|
copy_str(lwin.curr_dir, sizeof(lwin.curr_dir), test_data); |
|
|
534 |
|
char path[PATH_MAX]; |
|
535 |
|
|
|
536 |
|
snprintf(lwin.curr_dir, sizeof(lwin.curr_dir), "%s/..", test_data); |
533 |
537 |
flist_custom_start(&lwin, "test"); |
flist_custom_start(&lwin, "test"); |
534 |
538 |
flist_custom_add(&lwin, TEST_DATA_PATH "/existing-files"); |
flist_custom_add(&lwin, TEST_DATA_PATH "/existing-files"); |
535 |
539 |
flist_custom_add(&lwin, TEST_DATA_PATH "/existing-files/a"); |
flist_custom_add(&lwin, TEST_DATA_PATH "/existing-files/a"); |
|
540 |
|
copy_str(lwin.curr_dir, sizeof(lwin.curr_dir), test_data); |
536 |
541 |
assert_true(flist_custom_finish(&lwin, 0) == 0); |
assert_true(flist_custom_finish(&lwin, 0) == 0); |
537 |
542 |
assert_int_equal(2, lwin.list_rows); |
assert_int_equal(2, lwin.list_rows); |
538 |
543 |
|
|
539 |
544 |
fentry_rename(&lwin, &lwin.dir_entry[0], "existing_files"); |
fentry_rename(&lwin, &lwin.dir_entry[0], "existing_files"); |
540 |
|
assert_string_equal(TEST_DATA_PATH "/existing_files", |
|
541 |
|
lwin.dir_entry[1].origin); |
|
|
545 |
|
snprintf(path, sizeof(path), "%s/existing_files", test_data); |
|
546 |
|
assert_string_equal(path, lwin.dir_entry[1].origin); |
542 |
547 |
} |
} |
543 |
548 |
|
|
544 |
549 |
TEST(symlinks_are_not_resolved_in_origins, IF(not_windows)) |
TEST(symlinks_are_not_resolved_in_origins, IF(not_windows)) |
|
... |
... |
static void |
573 |
578 |
setup_custom_view(FileView *view, int very) |
setup_custom_view(FileView *view, int very) |
574 |
579 |
{ |
{ |
575 |
580 |
assert_false(flist_custom_active(view)); |
assert_false(flist_custom_active(view)); |
576 |
|
snprintf(view->curr_dir, sizeof(view->curr_dir), "%s/existing-files", |
|
577 |
|
test_data); |
|
|
581 |
|
snprintf(view->curr_dir, sizeof(view->curr_dir), "%s/..", test_data); |
578 |
582 |
flist_custom_start(view, "test"); |
flist_custom_start(view, "test"); |
579 |
583 |
flist_custom_add(view, TEST_DATA_PATH "/existing-files/a"); |
flist_custom_add(view, TEST_DATA_PATH "/existing-files/a"); |
|
584 |
|
snprintf(view->curr_dir, sizeof(view->curr_dir), "%s/existing-files", |
|
585 |
|
test_data); |
580 |
586 |
assert_true(flist_custom_finish(view, very) == 0); |
assert_true(flist_custom_finish(view, very) == 0); |
581 |
587 |
} |
} |
582 |
588 |
|
|