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 / utils / cut_extension.c (c24703b9ade3a9b1ee942982d1b88ad6c27d0fa2) (968B) (mode 100644) [raw]
#include <stic.h>

#include "../../src/utils/path.h"

TEST(no_extension)
{
	char buf[] = "file";
	assert_string_equal("", cut_extension(buf));
	assert_string_equal("file", buf);
}

TEST(unary_extensions)
{
	char buf[][20] =
	{
		"file.jpg",
		"program-1.0.zip",
		"tar.zip",
	};
	assert_string_equal("jpg", cut_extension(buf[0]));
	assert_string_equal("file", buf[0]);
	assert_string_equal("zip", cut_extension(buf[1]));
	assert_string_equal("program-1.0", buf[1]);
	assert_string_equal("zip", cut_extension(buf[2]));
	assert_string_equal("tar", buf[2]);
}

TEST(binary_extensions)
{
	char buf[][20] =
	{
		"archive.tar.gz",
		"photos.tar.bz2",
	};
	assert_string_equal("tar.gz", cut_extension(buf[0]));
	assert_string_equal("archive", buf[0]);
	assert_string_equal("tar.bz2", cut_extension(buf[1]));
	assert_string_equal("photos", buf[1]);
}

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