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 / navigation.c (887142b2ab4a692cf3250a0cfa2537973fc99f4e) (2,216B) (mode 100644) [raw]
#include <stic.h>

#include <stdlib.h> /* free() */
#include <string.h> /* strdup() */

#include <test-utils.h>

#include "../../src/cfg/config.h"
#include "../../src/utils/fs.h"
#include "../../src/utils/str.h"
#include "../../src/filelist.h"
#include "../../src/filtering.h"
#include "../../src/marks.h"
#include "../../src/running.h"

SETUP()
{
	char cwd[PATH_MAX + 1];

	curr_view = &lwin;
	other_view = &rwin;

	cfg.fuse_home = strdup("no");
	cfg.slow_fs_list = strdup("");
	cfg.chase_links = 1;

	view_setup(&lwin);
	view_setup(&rwin);

	assert_non_null(get_cwd(cwd, sizeof(cwd)));
	make_abs_path(lwin.curr_dir, sizeof(lwin.curr_dir), TEST_DATA_PATH, "..",
			cwd);
}

TEARDOWN()
{
	update_string(&cfg.slow_fs_list, NULL);
	update_string(&cfg.fuse_home, NULL);

	cfg.chase_links = 0;

	view_teardown(&lwin);
	view_teardown(&rwin);
}

TEST(custom_view_is_preserved_on_goto_mark)
{
	flist_custom_start(&lwin, "test");
	flist_custom_add(&lwin, TEST_DATA_PATH "/existing-files/a");
	assert_true(flist_custom_finish(&lwin, CV_REGULAR, 0) == 0);

	assert_success(marks_set_user(&lwin, 'a', TEST_DATA_PATH "/existing-files",
				"a"));

	assert_success(marks_goto(&lwin, 'a'));
	assert_true(flist_custom_active(&lwin));
}

TEST(local_filter_is_reset_in_cv_to_follow_mark)
{
	flist_custom_start(&lwin, "test");
	flist_custom_add(&lwin, TEST_DATA_PATH "/existing-files/a");
	assert_true(flist_custom_finish(&lwin, CV_REGULAR, 0) == 0);

	assert_success(marks_set_user(&lwin, 'a', TEST_DATA_PATH "/existing-files",
				"a"));
	assert_true(flist_custom_active(&lwin));

	local_filter_set(&lwin, "b");
	local_filter_accept(&lwin, /*update_history=*/1);
	assert_true(flist_custom_active(&lwin));

	assert_success(marks_goto(&lwin, 'a'));

	assert_true(flist_custom_active(&lwin));
	assert_true(filter_is_empty(&lwin.local_filter.filter));
}

TEST(following_resets_cv)
{
	flist_custom_start(&lwin, "test");
	flist_custom_add(&lwin, TEST_DATA_PATH "/existing-files/a");
	assert_true(flist_custom_finish(&lwin, CV_REGULAR, 0) == 0);

	rn_follow(&lwin, 0);
	assert_false(flist_custom_active(&lwin));
}

/* 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