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
1d5b6d7a
Commit
1d5b6d7a
authored
Nov 12, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test of pattern_formatter::clone()
parent
314991ac
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
tests/test_misc.cpp
tests/test_misc.cpp
+1
-1
tests/test_pattern_formatter.cpp
tests/test_pattern_formatter.cpp
+33
-0
No files found.
tests/test_misc.cpp
View file @
1d5b6d7a
...
@@ -92,7 +92,7 @@ TEST_CASE("periodic flush", "[periodic_flush]")
...
@@ -92,7 +92,7 @@ TEST_CASE("periodic flush", "[periodic_flush]")
spdlog
::
drop_all
();
spdlog
::
drop_all
();
}
}
TEST_CASE
(
"clone"
,
"[clone]"
)
TEST_CASE
(
"clone
-logger
"
,
"[clone]"
)
{
{
using
namespace
spdlog
;
using
namespace
spdlog
;
...
...
tests/test_pattern_formatter.cpp
View file @
1d5b6d7a
...
@@ -16,6 +16,7 @@ static std::string log_to_str(const std::string &msg, const Args &... args)
...
@@ -16,6 +16,7 @@ static std::string log_to_str(const std::string &msg, const Args &... args)
return
oss
.
str
();
return
oss
.
str
();
}
}
TEST_CASE
(
"custom eol"
,
"[pattern_formatter]"
)
TEST_CASE
(
"custom eol"
,
"[pattern_formatter]"
)
{
{
std
::
string
msg
=
"Hello custom eol test"
;
std
::
string
msg
=
"Hello custom eol test"
;
...
@@ -194,3 +195,35 @@ TEST_CASE("left_padded_max", "[pattern_formatter]")
...
@@ -194,3 +195,35 @@ TEST_CASE("left_padded_max", "[pattern_formatter]")
"[pattern_tester ]"
"[pattern_tester ]"
" Some message
\n
"
);
" Some message
\n
"
);
}
}
TEST_CASE
(
"clone-default-formatter"
,
"[pattern_formatter]"
)
{
auto
formatter_1
=
std
::
make_shared
<
spdlog
::
pattern_formatter
>
();
auto
formatter_2
=
formatter_1
->
clone
();
std
::
string
logger_name
=
"test"
;
spdlog
::
details
::
log_msg
msg
(
&
logger_name
,
spdlog
::
level
::
info
,
"some message"
);
fmt
::
memory_buffer
formatted_1
;
fmt
::
memory_buffer
formatted_2
;
formatter_1
->
format
(
msg
,
formatted_1
);
formatter_2
->
format
(
msg
,
formatted_2
);
REQUIRE
(
fmt
::
to_string
(
formatted_1
)
==
fmt
::
to_string
(
formatted_2
));
}
TEST_CASE
(
"clone-formatter"
,
"[pattern_formatter]"
)
{
auto
formatter_1
=
std
::
make_shared
<
spdlog
::
pattern_formatter
>
(
"%D %X [%] %v [%n] %v"
);
auto
formatter_2
=
formatter_1
->
clone
();
std
::
string
logger_name
=
"test"
;
spdlog
::
details
::
log_msg
msg
(
&
logger_name
,
spdlog
::
level
::
info
,
"some message"
);
fmt
::
memory_buffer
formatted_1
;
fmt
::
memory_buffer
formatted_2
;
formatter_1
->
format
(
msg
,
formatted_1
);
formatter_2
->
format
(
msg
,
formatted_2
);
REQUIRE
(
fmt
::
to_string
(
formatted_1
)
==
fmt
::
to_string
(
formatted_2
));
}
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