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 5de6c187d05a5e6f7631025f8a76d6cc5c6ec80e

Enable line completion only in tests that use it
It's invoked on failure to perform command completion which can break
unrelated tests (not now, but once line completion handler is invoked on
failure to parse :command's range).
Author: xaizek
Author date (UTC): 2024-04-07 09:01
Committer name: xaizek
Committer date (UTC): 2024-04-14 12:13
Parent(s): 8f2fe3792a0124124f96c0690c78341469f17f56
Signing key: 99DC5E4DB05F6BE2
Tree: cb19376ed6c67085de4bdb1f2df6ca63a5c4c5c4
File Lines added Lines deleted
tests/cmds/completion.c 6 0
tests/cmds/suite.c 10 5
tests/cmds/suite.h 2 0
File tests/cmds/completion.c changed (mode: 100644) (index 1a0bc9825..8563cdb5c)
8 8 #include "../../src/engine/completion.h" #include "../../src/engine/completion.h"
9 9 #include "../../src/utils/macros.h" #include "../../src/utils/macros.h"
10 10
11 #include "suite.h"
12
11 13 enum { COM_WINDO }; enum { COM_WINDO };
12 14
13 15 static int dummy_cmd(const cmd_info_t *cmd_info); static int dummy_cmd(const cmd_info_t *cmd_info);
 
... ... TEST(line_completion_no_args)
327 329 { {
328 330 char *buf; char *buf;
329 331
332 line_completion_enabled = 1;
333
330 334 vle_compl_reset(); vle_compl_reset();
331 335 assert_int_equal(0, vle_cmds_complete("notreallyacommand", NULL)); assert_int_equal(0, vle_cmds_complete("notreallyacommand", NULL));
332 336
 
... ... TEST(line_completion_args)
347 351 { {
348 352 char *buf; char *buf;
349 353
354 line_completion_enabled = 1;
355
350 356 vle_compl_reset(); vle_compl_reset();
351 357 assert_int_equal(0, vle_cmds_complete("notreally a command", NULL)); assert_int_equal(0, vle_cmds_complete("notreally a command", NULL));
352 358
File tests/cmds/suite.c changed (mode: 100644) (index dcee2fbc8..74d3761f0)
... ... cmds_conf_t cmds_conf = {
42 42 }; };
43 43
44 44 int swap_range; int swap_range;
45 int line_completion_enabled;
45 46
46 47 DEFINE_SUITE(); DEFINE_SUITE();
47 48
 
... ... SETUP()
67 68 vle_cmds_add(&command, 1); vle_cmds_add(&command, 1);
68 69
69 70 swap_range = 1; swap_range = 1;
71 line_completion_enabled = 0;
70 72 user_cmd_handler = &def_usercmd_cmd; user_cmd_handler = &def_usercmd_cmd;
71 73 } }
72 74
 
... ... TEARDOWN()
78 80 static int static int
79 81 complete_line(const char cmd_line[], void *extra_arg) complete_line(const char cmd_line[], void *extra_arg)
80 82 { {
81 vle_compl_reset();
82 vle_compl_add_match("whole-line1", "");
83 vle_compl_add_match("whole-line2", "");
84 vle_compl_finish_group();
85 vle_compl_add_last_match(cmd_line);
83 if(line_completion_enabled)
84 {
85 vle_compl_reset();
86 vle_compl_add_match("whole-line1", "");
87 vle_compl_add_match("whole-line2", "");
88 vle_compl_finish_group();
89 vle_compl_add_last_match(cmd_line);
90 }
86 91 return 0; return 0;
87 92 } }
88 93
File tests/cmds/suite.h changed (mode: 100644) (index 2342bf946..f95521576)
... ... extern int (*user_cmd_handler)(const struct cmd_info_t *cmd_info);
7 7
8 8 extern int swap_range; extern int swap_range;
9 9
10 extern int line_completion_enabled;
11
10 12 #endif /* VIFM_TESTS__SUITE_H__ */ #endif /* VIFM_TESTS__SUITE_H__ */
11 13
12 14 /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
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