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 / misc / rn_find_cmd.c (fcb83efab36d536d80caacd8e1ce9ee6c37965fc) (1,284B) (mode 100644) [raw]
#include <stic.h>

#include <test-utils.h>

#include "../../src/cfg/config.h"
#include "../../src/compat/fs_limits.h"
#include "../../src/engine/variables.h"
#include "../../src/utils/str.h"
#include "../../src/running.h"

SETUP()
{
	init_variables();
}

TEARDOWN()
{
	clear_variables();
}

TEST(emarks_are_skipped)
{
	char path[PATH_MAX + 1];
	assert_success(rn_find_cmd("!!/prog", sizeof(path), path));
	assert_string_equal("/prog", path);
}

TEST(tilde_is_expanded)
{
	char path[PATH_MAX + 1];
	copy_str(cfg.home_dir, sizeof(cfg.home_dir), "tilde_is_expanded/");
	assert_success(rn_find_cmd("~/prog", sizeof(path), path));
	assert_string_equal("tilde_is_expanded/prog", path);
}

TEST(envvars_are_expanded)
{
	char path[PATH_MAX + 1];
	let_variables("$TEST_ENVVAR = 'envvars_are_expanded'");
	assert_success(rn_find_cmd("$TEST_ENVVAR/prog", sizeof(path), path));
	assert_string_equal("envvars_are_expanded/prog", path);
}

TEST(envvars_are_expanded_for_path_search, IF(have_cat))
{
	char path[PATH_MAX + 1];
	let_variables("$TEST_ENVVAR = 'cat'");
	assert_success(rn_find_cmd("$TEST_ENVVAR", sizeof(path), path));
	assert_string_ends_with("/cat", path);
}

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