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 46a934717791b97ad82420d7b3840ba0cbac1c9d

Test argument parsing/passing of foreign :commands
This isn't due to some bug or to increase coverage. There was a
confusion caused by some non-ASCII space which led to writing of this
test, so may as well keep it.
Author: xaizek
Author date (UTC): 2026-03-14 12:42
Committer name: xaizek
Committer date (UTC): 2026-03-14 12:42
Parent(s): a9ba2fe226c48989bb36ee2de578b4b9b18b6f9a
Signing key: 99DC5E4DB05F6BE2
Tree: 80db4357ec5bb9349389c30cefb20349b22eea6d
File Lines added Lines deleted
tests/lua/api_cmds.c 29 0
File tests/lua/api_cmds.c changed (mode: 100644) (index f0684ef78..71f60655b)
... ... TEST(cmds_command)
123 123 "if not r then print 'fail' end"); "if not r then print 'fail' end");
124 124 } }
125 125
126 TEST(cmds_args)
127 {
128 cmds_init();
129
130 GLUA_EQ(vlua, "",
131 "r = vifm.cmds.add {"
132 " name = 'cmd',"
133 " minargs = 1,"
134 " maxargs = 2,"
135 " handler = function(info) argv = info.argv end,"
136 "}"
137 "if not r then print 'fail' end");
138
139 ui_sb_msg("");
140 assert_success(cmds_dispatch1("cmd arg", curr_view, CIT_COMMAND));
141 assert_string_equal("", ui_sb_last());
142
143 GLUA_EQ(vlua, "1", "print(#argv)");
144 GLUA_EQ(vlua, "arg", "print(argv[1])");
145
146 ui_sb_msg("");
147 assert_success(cmds_dispatch1("cmd arg1 arg2", curr_view, CIT_COMMAND));
148 assert_string_equal("", ui_sb_last());
149
150 GLUA_EQ(vlua, "2", "print(#argv)");
151 GLUA_EQ(vlua, "arg1", "print(argv[1])");
152 GLUA_EQ(vlua, "arg2", "print(argv[2])");
153 }
154
126 155 TEST(cmds_range) TEST(cmds_range)
127 156 { {
128 157 cmds_init(); cmds_init();
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