Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
c691769e
Unverified
Commit
c691769e
authored
Jan 06, 2021
by
Charles Milette
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix other build errors and unit tests
parent
19dc3056
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
19 deletions
+13
-19
tests/test_create_dir.cpp
tests/test_create_dir.cpp
+10
-16
tests/test_daily_logger.cpp
tests/test_daily_logger.cpp
+2
-2
tests/test_errors.cpp
tests/test_errors.cpp
+1
-1
No files found.
tests/test_create_dir.cpp
View file @
c691769e
...
@@ -55,26 +55,20 @@ TEST_CASE("dir_name", "[create_dir]")
...
@@ -55,26 +55,20 @@ TEST_CASE("dir_name", "[create_dir]")
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(dir\file.txt)"
))
==
SPDLOG_FILENAME_T
(
"dir"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(dir\file.txt)"
))
==
SPDLOG_FILENAME_T
(
"dir"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(dir/file)"
))
==
SPDLOG_FILENAME_T
(
"dir"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(dir/file)"
))
==
SPDLOG_FILENAME_T
(
"dir"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(dir\file.txt\)"
))
==
SPDLOG_FILENAME_T
(
R"(dir\file.txt)"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(dir\file.txt\)"
))
==
SPDLOG_FILENAME_T
(
R"(dir\file.txt)"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(dir/file.txt/)"
))
==
SPDLOG_FILENAME_T
(
R"(dir\file.txt)"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(\dir\file.txt)"
))
==
SPDLOG_FILENAME_T
(
R"(\dir)"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(\dir\file.txt)"
))
==
SPDLOG_FILENAME_T
(
R"(\dir)"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(/dir/file.txt)"
))
==
SPDLOG_FILENAME_T
(
R"(\dir)"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(\\dir\file.txt)"
))
==
SPDLOG_FILENAME_T
(
R"(\\dir)"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(\\dir\file.txt)"
))
==
SPDLOG_FILENAME_T
(
R"(\\dir)"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(//dir/file.txt)"
))
==
SPDLOG_FILENAME_T
(
R"(\\dir)"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(..\file.txt)"
))
==
SPDLOG_FILENAME_T
(
".."
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(..\file.txt)"
))
==
SPDLOG_FILENAME_T
(
".."
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(../file.txt)"
))
==
SPDLOG_FILENAME_T
(
".."
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(.\file.txt)"
))
==
SPDLOG_FILENAME_T
(
"."
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(.\file.txt)"
))
==
SPDLOG_FILENAME_T
(
"."
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(./file.txt)"
))
==
SPDLOG_FILENAME_T
(
"."
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(c:\\a\b\c\d\file.txt)"
))
==
SPDLOG_FILENAME_T
(
R"(c:\\a\b\c\d)"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(c:\\a\b\c\d\file.txt)"
))
==
SPDLOG_FILENAME_T
(
R"(c:\\a\b\c\d)"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(c://a/b/c/d/file.txt)"
))
==
SPDLOG_FILENAME_T
(
R"(c:\\a\b\c\d)"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
R"(c://a/b/c/d/file.txt)"
))
==
SPDLOG_FILENAME_T
(
R"(c://a/b/c/d)"
));
#else
REQUIRE
(
dir_name
(
"dir/"
)
==
"dir"
);
REQUIRE
(
dir_name
(
"dir///"
)
==
"dir//"
);
REQUIRE
(
dir_name
(
"dir/file"
)
==
"dir"
);
REQUIRE
(
dir_name
(
"dir/file.txt"
)
==
"dir"
);
REQUIRE
(
dir_name
(
"dir/file.txt/"
)
==
"dir/file.txt"
);
REQUIRE
(
dir_name
(
"/dir/file.txt"
)
==
"/dir"
);
REQUIRE
(
dir_name
(
"//dir/file.txt"
)
==
"//dir"
);
REQUIRE
(
dir_name
(
"../file.txt"
)
==
".."
);
REQUIRE
(
dir_name
(
"./file.txt"
)
==
"."
);
#endif
#endif
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
"dir/"
))
==
SPDLOG_FILENAME_T
(
"dir"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
"dir///"
))
==
SPDLOG_FILENAME_T
(
"dir//"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
"dir/file"
))
==
SPDLOG_FILENAME_T
(
"dir"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
"dir/file.txt"
))
==
SPDLOG_FILENAME_T
(
"dir"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
"dir/file.txt/"
))
==
SPDLOG_FILENAME_T
(
"dir/file.txt"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
"/dir/file.txt"
))
==
SPDLOG_FILENAME_T
(
"/dir"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
"//dir/file.txt"
))
==
SPDLOG_FILENAME_T
(
"//dir"
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
"../file.txt"
))
==
SPDLOG_FILENAME_T
(
".."
));
REQUIRE
(
dir_name
(
SPDLOG_FILENAME_T
(
"./file.txt"
))
==
SPDLOG_FILENAME_T
(
"."
));
}
}
tests/test_daily_logger.cpp
View file @
c691769e
...
@@ -52,8 +52,8 @@ TEST_CASE("daily_logger with custom calculator", "[daily_logger]")
...
@@ -52,8 +52,8 @@ TEST_CASE("daily_logger with custom calculator", "[daily_logger]")
// calculate filename (time based)
// calculate filename (time based)
spdlog
::
filename_t
basename
=
SPDLOG_FILENAME_T
(
"test_logs/daily_dateonly"
);
spdlog
::
filename_t
basename
=
SPDLOG_FILENAME_T
(
"test_logs/daily_dateonly"
);
std
::
tm
tm
=
spdlog
::
details
::
os
::
localtime
();
std
::
tm
tm
=
spdlog
::
details
::
os
::
localtime
();
spdlog
::
memory_buf_t
w
;
spdlog
::
filename_
memory_buf_t
w
;
fmt
::
format_to
(
w
,
"{}{:04d}{:02d}{:02d}"
,
basename
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
);
fmt
::
format_to
(
w
,
SPDLOG_FILENAME_T
(
"{}{:04d}{:02d}{:02d}"
)
,
basename
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
);
auto
logger
=
spdlog
::
create
<
sink_type
>
(
"logger"
,
basename
,
0
,
0
);
auto
logger
=
spdlog
::
create
<
sink_type
>
(
"logger"
,
basename
,
0
,
0
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
for
(
int
i
=
0
;
i
<
10
;
++
i
)
...
...
tests/test_errors.cpp
View file @
c691769e
...
@@ -100,7 +100,7 @@ TEST_CASE("async_error_handler2", "[errors]]")
...
@@ -100,7 +100,7 @@ TEST_CASE("async_error_handler2", "[errors]]")
prepare_logdir
();
prepare_logdir
();
std
::
string
err_msg
(
"This is async handler error message"
);
std
::
string
err_msg
(
"This is async handler error message"
);
{
{
spdlog
::
details
::
os
::
create_dir
(
"test_logs"
);
spdlog
::
details
::
os
::
create_dir
(
SPDLOG_FILENAME_T
(
"test_logs"
)
);
spdlog
::
init_thread_pool
(
128
,
1
);
spdlog
::
init_thread_pool
(
128
,
1
);
auto
logger
=
spdlog
::
create_async
<
failing_sink
>
(
"failed_logger"
);
auto
logger
=
spdlog
::
create_async
<
failing_sink
>
(
"failed_logger"
);
logger
->
set_error_handler
([
=
](
const
std
::
string
&
)
{
logger
->
set_error_handler
([
=
](
const
std
::
string
&
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment