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.
<root> / tests / menus / users.c (097fa41953c3a98471a24045dc3722946dea9318) (1,547B) (mode 100644) [raw]
#include <stic.h>

#include <test-utils.h>

#include "../../src/cfg/config.h"
#include "../../src/engine/keys.h"
#include "../../src/lua/vlua.h"
#include "../../src/modes/modes.h"
#include "../../src/modes/wk.h"
#include "../../src/ui/ui.h"
#include "../../src/utils/str.h"
#include "../../src/cmd_core.h"
#include "../../src/status.h"
#include "../lua/asserts.h"

SETUP()
{
	modes_init();
	cmds_init();
	conf_setup();
	undo_setup();

	curr_stats.load_stage = -1;
	curr_view = &lwin;
	other_view = &rwin;
}

TEARDOWN()
{
	vle_keys_reset();
	conf_teardown();
	undo_teardown();

	curr_stats.load_stage = 0;
	curr_view = NULL;
	other_view = NULL;
}

TEST(v_key)
{
	assert_success(cmds_dispatch("!echo path %M", &lwin, CIT_COMMAND));

	curr_stats.vlua = vlua_init();

	update_string(&cfg.vi_command, "#vifmtest#editor");

	GLUA_EQ(curr_stats.vlua, "",
			"function handler(info) ginfo = info; return { success = false } end");
	GLUA_EQ(curr_stats.vlua, "",
			"vifm.addhandler{ name = 'editor', handler = handler }");

	(void)vle_keys_exec(WK_v);

	GLUA_EQ(curr_stats.vlua, "edit-list", "print(ginfo.action)");
	GLUA_EQ(curr_stats.vlua, "1", "print(#ginfo.entries)");
	GLUA_EQ(curr_stats.vlua, "path", "print(ginfo.entries[1])");
	GLUA_EQ(curr_stats.vlua, "1", "print(ginfo.current)");
	GLUA_EQ(curr_stats.vlua, "false", "print(ginfo.isquickfix)");

	vlua_finish(curr_stats.vlua);
	curr_stats.vlua = NULL;

	(void)vle_keys_exec(WK_q);
}

/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
/* vim: set cinoptions+=t0 : */
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