From bfc76278a9ab5ff1e5530d32ed24f263e55aa187 Mon Sep 17 00:00:00 2001 From: gabime Date: Fri, 25 Oct 2019 15:24:54 +0300 Subject: [PATCH] update tests --- build-branch/example/Debug/logs/mylog.txt | 2 ++ build-branch/example/Debug/mylog.txt | 1 + build-branch/example/logs2/basic-log.txt | 0 build-branch/example/mylog.txt | 2 ++ build-branch/tests/Debug/test_logs/custom_err2.txt | 1 - tests/test_create_dir.cpp | 11 +++++++++-- 6 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 build-branch/example/Debug/logs/mylog.txt create mode 100644 build-branch/example/Debug/mylog.txt delete mode 100644 build-branch/example/logs2/basic-log.txt create mode 100644 build-branch/example/mylog.txt delete mode 100644 build-branch/tests/Debug/test_logs/custom_err2.txt diff --git a/build-branch/example/Debug/logs/mylog.txt b/build-branch/example/Debug/logs/mylog.txt new file mode 100644 index 00000000..040f5132 --- /dev/null +++ b/build-branch/example/Debug/logs/mylog.txt @@ -0,0 +1,2 @@ +[2019-10-25 15:16:33.502] [LOGGER] [info] Hello +[2019-10-25 15:16:41.712] [LOGGER] [info] Hello diff --git a/build-branch/example/Debug/mylog.txt b/build-branch/example/Debug/mylog.txt new file mode 100644 index 00000000..f4e0ab68 --- /dev/null +++ b/build-branch/example/Debug/mylog.txt @@ -0,0 +1 @@ +[2019-10-25 15:16:58.845] [LOGGER] [info] Hello diff --git a/build-branch/example/logs2/basic-log.txt b/build-branch/example/logs2/basic-log.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/build-branch/example/mylog.txt b/build-branch/example/mylog.txt new file mode 100644 index 00000000..a7126955 --- /dev/null +++ b/build-branch/example/mylog.txt @@ -0,0 +1,2 @@ +[2019-10-25 15:16:53.945] [LOGGER] [info] Hello +[2019-10-25 15:18:50.127] [LOGGER] [info] Hello diff --git a/build-branch/tests/Debug/test_logs/custom_err2.txt b/build-branch/tests/Debug/test_logs/custom_err2.txt deleted file mode 100644 index 58a61097..00000000 --- a/build-branch/tests/Debug/test_logs/custom_err2.txt +++ /dev/null @@ -1 +0,0 @@ -This is async handler error message \ No newline at end of file diff --git a/tests/test_create_dir.cpp b/tests/test_create_dir.cpp index 56f4282d..9ce13675 100644 --- a/tests/test_create_dir.cpp +++ b/tests/test_create_dir.cpp @@ -13,7 +13,6 @@ bool try_create_dir(const char *path, const char *normalized_path) return file_exists(normalized_path); } -#include "spdlog/sinks/stdout_color_sinks.h" TEST_CASE("create_dir", "[create_dir]") { @@ -26,7 +25,7 @@ TEST_CASE("create_dir", "[create_dir]") REQUIRE(try_create_dir("test_logs/../test_logs/dir1/dir4", "test_logs/dir1/dir4")); #ifdef WIN32 - // test backslash + // test backslash folder separator REQUIRE(try_create_dir("test_logs\\dir1\\dir222", "test_logs\\dir1\\dir222")); REQUIRE(try_create_dir("test_logs\\dir1\\dir223\\", "test_logs\\dir1\\dir223\\")); REQUIRE(try_create_dir(".\\test_logs\\dir1\\dir2\\dir99\\..\\dir23", "test_logs\\dir1\\dir2\\dir23")); @@ -45,13 +44,21 @@ TEST_CASE("dir_name", "[create_dir]") REQUIRE(dir_name(R"(dir\)") == "dir"); REQUIRE(dir_name(R"(dir\\\)") == R"(dir\\)"); REQUIRE(dir_name(R"(dir\file)") == "dir"); + REQUIRE(dir_name(R"(dir/file)") == "dir"); REQUIRE(dir_name(R"(dir\file.txt)") == "dir"); + REQUIRE(dir_name(R"(dir/file)") == "dir"); REQUIRE(dir_name(R"(dir\file.txt\)") == R"(dir\file.txt)"); + REQUIRE(dir_name(R"(dir/file.txt/)") == R"(dir\file.txt)"); REQUIRE(dir_name(R"(\dir\file.txt)") == R"(\dir)"); + REQUIRE(dir_name(R"(/dir/file.txt)") == R"(\dir)"); REQUIRE(dir_name(R"(\\dir\file.txt)") == R"(\\dir)"); + REQUIRE(dir_name(R"(//dir/file.txt)") == R"(\\dir)"); REQUIRE(dir_name(R"(..\file.txt)") == ".."); + REQUIRE(dir_name(R"(../file.txt)") == ".."); REQUIRE(dir_name(R"(.\file.txt)") == "."); + REQUIRE(dir_name(R"(./file.txt)") == "."); REQUIRE(dir_name(R"(c:\\a\b\c\d\file.txt)") == R"(c:\\a\b\c\d)"); + REQUIRE(dir_name(R"(c://a/b/c/d/file.txt)") == R"(c:\\a\b\c\d)"); #else REQUIRE(dir_name("dir/") == "dir"); REQUIRE(dir_name("dir///") == "dir//");