mirror of https://github.com/gabime/spdlog.git
auto create log dir
parent
4858d7e454
commit
9b7812a0f2
@ -1,5 +1,4 @@
|
||||
executable('example', 'example.cpp', dependencies: spdlog_dep)
|
||||
executable('example_header_only', 'example.cpp', dependencies: spdlog_headeronly_dep)
|
||||
run_command(find_program('mkdir'), meson.current_build_dir() + '/logs')
|
||||
|
||||
|
||||
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This content is released under the MIT License as specified in https://raw.githubusercontent.com/gabime/spdlog/master/LICENSE
|
||||
*/
|
||||
#include "includes.h"
|
||||
|
||||
using spdlog::details::os::create_dir;
|
||||
using spdlog::details::os::file_exists;
|
||||
|
||||
void test_create_dir(const char *path, const char *normalized_path)
|
||||
{
|
||||
auto rv = create_dir(path);
|
||||
REQUIRE(rv == true);
|
||||
REQUIRE(file_exists(normalized_path));
|
||||
}
|
||||
|
||||
#include "spdlog/sinks/stdout_color_sinks.h"
|
||||
|
||||
TEST_CASE("create_dir", "[create_dir]")
|
||||
{
|
||||
prepare_logdir();
|
||||
test_create_dir("test_logs/dir1/dir1", "test_logs/dir1/dir1");
|
||||
test_create_dir("test_logs/dir1///dir2", "test_logs/dir1/dir2");
|
||||
test_create_dir("./test_logs/dir1/dir3", "test_logs/dir1/dir3");
|
||||
test_create_dir("test_logs/../test_logs/dir1/dir4", "test_logs/dir1/dir4");
|
||||
test_create_dir("./test_logs/dir1/dir2/dir99/../dir23", "test_logs/dir1/dir2/dir23");
|
||||
spdlog::drop("test-create-dir");
|
||||
}
|
Loading…
Reference in New Issue