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 / cline.c (0bb97673c5f6b8407072fd409e434acc44eaf3ce) (1,203B) (mode 100644) [raw]
#include <stic.h>

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

#include "../../src/ui/colored_line.h"

TEST(left_ellipsis_for_cline)
{
	cline_t cline = {
		.line = strdup("12345"),
		.line_len = strlen(cline.line),
		.attrs = strdup(""),
		.attrs_len = strlen(cline.attrs),
	};

	cline_left_ellipsis(&cline, 2, "abc");
	assert_string_equal("ab", cline.line);
	assert_int_equal(strlen(cline.line), cline.line_len);
	assert_string_equal("  ", cline.attrs);
	assert_int_equal(strlen(cline.attrs), cline.attrs_len);

	cline_dispose(&cline);
}

TEST(append_works)
{
	cline_t left = {
		.line = strdup("left"),
		.line_len = strlen(left.line),
		.attrs = strdup(""),
		.attrs_len = strlen(left.attrs),
	};

	cline_t right = {
		.line = strdup("right"),
		.line_len = strlen(right.line),
		.attrs = strdup(""),
		.attrs_len = strlen(right.attrs),
	};

	cline_append(&left, &right);
	assert_string_equal("leftright", left.line);
	assert_int_equal(strlen(left.line), left.line_len);
	assert_string_equal("    ", left.attrs);
	assert_int_equal(strlen(left.attrs), left.attrs_len);

	cline_dispose(&left);
}

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