File tests/misc/running.c changed (mode: 100644) (index 8c7a3cd58..4c93c4fd9) |
... |
... |
TEST(entering_a_directory, IF(not_windows)) |
365 |
365 |
stop_use_script(); |
stop_use_script(); |
366 |
366 |
} |
} |
367 |
367 |
|
|
|
368 |
|
TEST(macro_can_be_added_implicitly, IF(not_windows)) |
|
369 |
|
{ |
|
370 |
|
start_use_script(); |
|
371 |
|
lwin.dir_entry[1].selected = 0; |
|
372 |
|
|
|
373 |
|
char *error; |
|
374 |
|
matchers_t *ms = matchers_alloc("{a}", 0, 1, "", &error); |
|
375 |
|
assert_non_null(ms); |
|
376 |
|
|
|
377 |
|
char cmd[PATH_MAX + 1]; |
|
378 |
|
snprintf(cmd, sizeof(cmd), "%s a", script_path); |
|
379 |
|
ft_set_programs(ms, cmd, 0, 0); |
|
380 |
|
|
|
381 |
|
rn_open(&lwin, FHE_NO_RUN); |
|
382 |
|
|
|
383 |
|
const char *lines[] = { "a" }; |
|
384 |
|
file_is(SANDBOX_PATH "/a-list", lines, ARRAY_LEN(lines)); |
|
385 |
|
|
|
386 |
|
assert_success(remove(SANDBOX_PATH "/a-list")); |
|
387 |
|
assert_failure(remove(SANDBOX_PATH "/vi-list")); |
|
388 |
|
|
|
389 |
|
stop_use_script(); |
|
390 |
|
} |
|
391 |
|
|
|
392 |
|
TEST(handler_can_be_matched_by_a_prefix, IF(not_windows)) |
|
393 |
|
{ |
|
394 |
|
start_use_script(); |
|
395 |
|
lwin.dir_entry[1].selected = 0; |
|
396 |
|
|
|
397 |
|
char *error; |
|
398 |
|
matchers_t *ms = matchers_alloc("{a}", 0, 1, "", &error); |
|
399 |
|
assert_non_null(ms); |
|
400 |
|
|
|
401 |
|
char cmd[PATH_MAX + 1]; |
|
402 |
|
snprintf(cmd, sizeof(cmd), "{wrong}no-such-cmd a, {right}%s a", script_path); |
|
403 |
|
ft_set_programs(ms, cmd, 0, 0); |
|
404 |
|
|
|
405 |
|
rn_open_with_match(&lwin, script_path, 0); |
|
406 |
|
|
|
407 |
|
const char *lines[] = { "a" }; |
|
408 |
|
file_is(SANDBOX_PATH "/a-list", lines, ARRAY_LEN(lines)); |
|
409 |
|
|
|
410 |
|
assert_success(remove(SANDBOX_PATH "/a-list")); |
|
411 |
|
assert_failure(remove(SANDBOX_PATH "/vi-list")); |
|
412 |
|
|
|
413 |
|
stop_use_script(); |
|
414 |
|
} |
|
415 |
|
|
368 |
416 |
static int |
static int |
369 |
417 |
prog_exists(const char name[]) |
prog_exists(const char name[]) |
370 |
418 |
{ |
{ |