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 29298dfd4ec734ee4235239505740a0098f00983

Test and correct ft_assoc_exists()
The correction is skipping whitespace after '}' of optional description.
Author: xaizek
Author date (UTC): 2025-07-14 08:56
Committer name: xaizek
Committer date (UTC): 2025-07-14 17:53
Parent(s): f64bad01f75c89bc8f17ce8153ebba1b58ae6d3b
Signing key: 99DC5E4DB05F6BE2
Tree: f0c0fbca7c480afbe9803390faa7bdf2953e1e6d
File Lines added Lines deleted
src/filetype.c 1 1
tests/filetype/filetype.c 16 0
File src/filetype.c changed (mode: 100644) (index 36691aac8..aee1a9f6c)
... ... ft_assoc_exists(const assoc_list_t *assocs, const char pattern[],
471 471 const char *const descr_end = strchr(cmd + 1, '}'); const char *const descr_end = strchr(cmd + 1, '}');
472 472 if(descr_end != NULL) if(descr_end != NULL)
473 473 { {
474 cmd = descr_end + 1;
474 cmd = skip_whitespace(descr_end + 1);
475 475 } }
476 476 } }
477 477
File tests/filetype/filetype.c changed (mode: 100644) (index 116cd35ca..94086afbe)
... ... TEST(zero_length_match)
164 164 assert_null(prog_cmd = ft_get_program("git")); assert_null(prog_cmd = ft_get_program("git"));
165 165 } }
166 166
167 TEST(existence_check)
168 {
169 assoc_programs("*.git", "tig", 0, 0);
170
171 assert_false(ft_assoc_exists(&filetypes, "git", "tig"));
172
173 assert_false(ft_assoc_exists(&filetypes, "*.git", "ti"));
174 assert_false(ft_assoc_exists(&filetypes, "*.git", "{tig"));
175 assert_false(ft_assoc_exists(&filetypes, "*.git", "{tig}"));
176
177 assert_true(ft_assoc_exists(&filetypes, "*.git", "tig"));
178 assert_true(ft_assoc_exists(&filetypes, "*.git", "{}tig"));
179 assert_true(ft_assoc_exists(&filetypes, "*.git", "{help text}tig"));
180 assert_true(ft_assoc_exists(&filetypes, "*.git", "{help text}\t tig"));
181 }
182
167 183 TEST(pattern_list, IF(has_mime_type_detection)) TEST(pattern_list, IF(has_mime_type_detection))
168 184 { {
169 185 char cmd[1024]; char cmd[1024];
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