xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit a4d3e8ab4ed2cd1625436bcc5de1c45ce612ee65

Test bad editor call on 'extprompt'
Author: xaizek
Author date (UTC): 2025-12-21 09:04
Committer name: xaizek
Committer date (UTC): 2025-12-21 09:04
Parent(s): 375609d8f24fd717adaeb490aced3b0e7936dd53
Signing key: 99DC5E4DB05F6BE2
Tree: c36de65cdf7fad79fffaa968b5be6f74e5906959
File Lines added Lines deleted
tests/misc/integration.c 53 0
File tests/misc/integration.c changed (mode: 100644) (index 18840dc51..0d36d264b)
13 13 #include "../../src/engine/keys.h" #include "../../src/engine/keys.h"
14 14 #include "../../src/int/term_title.h" #include "../../src/int/term_title.h"
15 15 #include "../../src/int/vim.h" #include "../../src/int/vim.h"
16 #include "../../src/modes/dialogs/msg_dialog.h"
16 17 #include "../../src/modes/modes.h" #include "../../src/modes/modes.h"
17 18 #include "../../src/modes/wk.h" #include "../../src/modes/wk.h"
18 19 #include "../../src/ui/column_view.h" #include "../../src/ui/column_view.h"
 
25 26 #include "../../src/fops_rename.h" #include "../../src/fops_rename.h"
26 27 #include "../../src/status.h" #include "../../src/status.h"
27 28
29 static int bad_editor_call(const char type[], const char title[],
30 const char message[]);
31
28 32 SETUP() SETUP()
29 33 { {
30 34 update_string(&cfg.shell, ""); update_string(&cfg.shell, "");
 
... ... TEST(extprompt_rename, IF(not_windows))
339 343 cfg.ext_prompt = EP_NONE; cfg.ext_prompt = EP_NONE;
340 344 } }
341 345
346 TEST(extprompt_rename_fail, IF(not_windows))
347 {
348 undo_setup();
349
350 curr_view = &lwin;
351 view_setup(&lwin);
352 lwin.columns = columns_create();
353
354 cfg.ext_prompt = EP_PATH;
355 opt_handlers_setup();
356
357 create_file(SANDBOX_PATH "/old-name");
358
359 make_abs_path(lwin.curr_dir, sizeof(lwin.curr_dir), SANDBOX_PATH, "", NULL);
360 load_dir_list(&lwin, 0);
361
362 /* Not providing a shell to cause a failure. */
363 update_string(&cfg.shell, "not-a-shell");
364 stats_update_shell_type("/bin/sh");
365
366 dlg_set_callback(&bad_editor_call);
367
368 fops_rename_current(&lwin, /*name_only=*/0);
369
370 remove_file(SANDBOX_PATH "/old-name");
371 no_remove_file(SANDBOX_PATH "/new-name");
372
373 view_teardown(&lwin);
374
375 vle_keys_reset();
376 opt_handlers_teardown();
377 columns_teardown();
378 undo_teardown();
379
380 cfg.ext_prompt = EP_NONE;
381 }
382
342 383 TEST(title_support_is_detected_correctly) TEST(title_support_is_detected_correctly)
343 384 { {
344 385 static char *XTERM_LIKE[] = { static char *XTERM_LIKE[] = {
 
... ... TEST(paths_are_escaped_for_the_editor)
408 449 restore_cwd(saved_cwd); restore_cwd(saved_cwd);
409 450 } }
410 451
452 static int
453 bad_editor_call(const char type[], const char title[], const char message[])
454 {
455 assert_string_equal("error", type);
456 assert_string_equal("Editing", title);
457 assert_string_starts_with("Error querying data from external source.",
458 message);
459
460 dlg_set_callback(NULL);
461 return 0;
462 }
463
411 464 /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
412 465 /* vim: set cinoptions+=t0 filetype=c : */ /* vim: set cinoptions+=t0 filetype=c : */
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master