astyle
This commit is contained in:
		@@ -76,42 +76,42 @@ TEST_CASE("file_helper_reopen2", "[file_helper::reopen(false)]]")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void test_split_ext(const char* fname, const char* expect_base, const char* expect_ext)
 | 
			
		||||
{	
 | 
			
		||||
	spdlog::filename_t filename(fname);
 | 
			
		||||
	spdlog::filename_t expected_base(expect_base);
 | 
			
		||||
	spdlog::filename_t expected_ext(expect_ext);
 | 
			
		||||
{
 | 
			
		||||
    spdlog::filename_t filename(fname);
 | 
			
		||||
    spdlog::filename_t expected_base(expect_base);
 | 
			
		||||
    spdlog::filename_t expected_ext(expect_ext);
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32 // replace folder sep
 | 
			
		||||
		std::replace(filename.begin(), filename.end(), '/', '\\'); 
 | 
			
		||||
		std::replace(expected_base.begin(), expected_base.end(), '/', '\\');		
 | 
			
		||||
    std::replace(filename.begin(), filename.end(), '/', '\\');
 | 
			
		||||
    std::replace(expected_base.begin(), expected_base.end(), '/', '\\');
 | 
			
		||||
#endif
 | 
			
		||||
	spdlog::filename_t basename, ext;
 | 
			
		||||
	std::tie(basename, ext) = file_helper::split_by_extenstion(filename);		
 | 
			
		||||
	REQUIRE(basename == expected_base);
 | 
			
		||||
	REQUIRE(ext == expected_ext);	
 | 
			
		||||
    spdlog::filename_t basename, ext;
 | 
			
		||||
    std::tie(basename, ext) = file_helper::split_by_extenstion(filename);
 | 
			
		||||
    REQUIRE(basename == expected_base);
 | 
			
		||||
    REQUIRE(ext == expected_ext);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST_CASE("file_helper_split_by_extenstion", "[file_helper::split_by_extenstion()]]")
 | 
			
		||||
{	
 | 
			
		||||
	test_split_ext("mylog.txt", "mylog", ".txt");
 | 
			
		||||
	test_split_ext(".mylog.txt", ".mylog", ".txt");
 | 
			
		||||
	test_split_ext(".mylog", ".mylog", "");
 | 
			
		||||
	test_split_ext("/aaa/bb.d/mylog", "/aaa/bb.d/mylog", "");
 | 
			
		||||
	test_split_ext("/aaa/bb.d/mylog.txt", "/aaa/bb.d/mylog", ".txt");
 | 
			
		||||
	test_split_ext("aaa/bbb/ccc/mylog.txt", "aaa/bbb/ccc/mylog", ".txt");
 | 
			
		||||
	test_split_ext("aaa/bbb/ccc/mylog.", "aaa/bbb/ccc/mylog.", "");
 | 
			
		||||
	test_split_ext("aaa/bbb/ccc/.mylog.txt", "aaa/bbb/ccc/.mylog", ".txt");
 | 
			
		||||
	test_split_ext("/aaa/bbb/ccc/mylog.txt", "/aaa/bbb/ccc/mylog", ".txt");
 | 
			
		||||
	test_split_ext("/aaa/bbb/ccc/.mylog", "/aaa/bbb/ccc/.mylog", "");
 | 
			
		||||
	test_split_ext("../mylog.txt", "../mylog", ".txt");
 | 
			
		||||
	test_split_ext(".././mylog.txt", ".././mylog", ".txt");
 | 
			
		||||
	test_split_ext(".././mylog.txt/xxx", ".././mylog.txt/xxx", "");		
 | 
			
		||||
	test_split_ext("/mylog.txt", "/mylog", ".txt");
 | 
			
		||||
	test_split_ext("//mylog.txt", "//mylog", ".txt");
 | 
			
		||||
	test_split_ext("", "", "");
 | 
			
		||||
	test_split_ext(".", ".", "");
 | 
			
		||||
	test_split_ext("..txt", ".", ".txt");
 | 
			
		||||
{
 | 
			
		||||
    test_split_ext("mylog.txt", "mylog", ".txt");
 | 
			
		||||
    test_split_ext(".mylog.txt", ".mylog", ".txt");
 | 
			
		||||
    test_split_ext(".mylog", ".mylog", "");
 | 
			
		||||
    test_split_ext("/aaa/bb.d/mylog", "/aaa/bb.d/mylog", "");
 | 
			
		||||
    test_split_ext("/aaa/bb.d/mylog.txt", "/aaa/bb.d/mylog", ".txt");
 | 
			
		||||
    test_split_ext("aaa/bbb/ccc/mylog.txt", "aaa/bbb/ccc/mylog", ".txt");
 | 
			
		||||
    test_split_ext("aaa/bbb/ccc/mylog.", "aaa/bbb/ccc/mylog.", "");
 | 
			
		||||
    test_split_ext("aaa/bbb/ccc/.mylog.txt", "aaa/bbb/ccc/.mylog", ".txt");
 | 
			
		||||
    test_split_ext("/aaa/bbb/ccc/mylog.txt", "/aaa/bbb/ccc/mylog", ".txt");
 | 
			
		||||
    test_split_ext("/aaa/bbb/ccc/.mylog", "/aaa/bbb/ccc/.mylog", "");
 | 
			
		||||
    test_split_ext("../mylog.txt", "../mylog", ".txt");
 | 
			
		||||
    test_split_ext(".././mylog.txt", ".././mylog", ".txt");
 | 
			
		||||
    test_split_ext(".././mylog.txt/xxx", ".././mylog.txt/xxx", "");
 | 
			
		||||
    test_split_ext("/mylog.txt", "/mylog", ".txt");
 | 
			
		||||
    test_split_ext("//mylog.txt", "//mylog", ".txt");
 | 
			
		||||
    test_split_ext("", "", "");
 | 
			
		||||
    test_split_ext(".", ".", "");
 | 
			
		||||
    test_split_ext("..txt", ".", ".txt");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user