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
18f0e4ba
Commit
18f0e4ba
authored
Nov 11, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some pattern-formatter padding tests
parent
6fedffe6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
tests/test_pattern_formatter.cpp
tests/test_pattern_formatter.cpp
+71
-0
No files found.
tests/test_pattern_formatter.cpp
View file @
18f0e4ba
...
...
@@ -129,3 +129,74 @@ TEST_CASE("color range test6", "[pattern_formatter]")
REQUIRE
(
msg
.
color_range_start
==
0
);
REQUIRE
(
msg
.
color_range_end
==
2
);
}
//
// Test padding
//
TEST_CASE
(
"level_left_padded"
,
"[pattern_formatter]"
)
{
REQUIRE
(
log_to_str
(
"Some message"
,
"[%8l] %v"
,
spdlog
::
pattern_time_type
::
local
,
"
\n
"
)
==
"[ info] Some message
\n
"
);
}
TEST_CASE
(
"level_right_padded"
,
"[pattern_formatter]"
)
{
REQUIRE
(
log_to_str
(
"Some message"
,
"[%-8l] %v"
,
spdlog
::
pattern_time_type
::
local
,
"
\n
"
)
==
"[info ] Some message
\n
"
);
}
TEST_CASE
(
"level_center_padded"
,
"[pattern_formatter]"
)
{
REQUIRE
(
log_to_str
(
"Some message"
,
"[%=8l] %v"
,
spdlog
::
pattern_time_type
::
local
,
"
\n
"
)
==
"[ info ] Some message
\n
"
);
}
TEST_CASE
(
"short level_left_padded"
,
"[pattern_formatter]"
)
{
REQUIRE
(
log_to_str
(
"Some message"
,
"[%3L] %v"
,
spdlog
::
pattern_time_type
::
local
,
"
\n
"
)
==
"[ I] Some message
\n
"
);
}
TEST_CASE
(
"short level_right_padded"
,
"[pattern_formatter]"
)
{
REQUIRE
(
log_to_str
(
"Some message"
,
"[%-3L] %v"
,
spdlog
::
pattern_time_type
::
local
,
"
\n
"
)
==
"[I ] Some message
\n
"
);
}
TEST_CASE
(
"short level_center_padded"
,
"[pattern_formatter]"
)
{
REQUIRE
(
log_to_str
(
"Some message"
,
"[%=3L] %v"
,
spdlog
::
pattern_time_type
::
local
,
"
\n
"
)
==
"[ I ] Some message
\n
"
);
}
TEST_CASE
(
"left_padded_short"
,
"[pattern_formatter]"
)
{
REQUIRE
(
log_to_str
(
"Some message"
,
"[%3n] %v"
,
spdlog
::
pattern_time_type
::
local
,
"
\n
"
)
==
"[pattern_tester] Some message
\n
"
);
}
TEST_CASE
(
"right_padded_short"
,
"[pattern_formatter]"
)
{
REQUIRE
(
log_to_str
(
"Some message"
,
"[%-3n] %v"
,
spdlog
::
pattern_time_type
::
local
,
"
\n
"
)
==
"[pattern_tester] Some message
\n
"
);
}
TEST_CASE
(
"center_padded_short"
,
"[pattern_formatter]"
)
{
REQUIRE
(
log_to_str
(
"Some message"
,
"[%=3n] %v"
,
spdlog
::
pattern_time_type
::
local
,
"
\n
"
)
==
"[pattern_tester] Some message
\n
"
);
}
TEST_CASE
(
"left_padded_huge"
,
"[pattern_formatter]"
)
{
REQUIRE
(
log_to_str
(
"Some message"
,
"[%-300n] %v"
,
spdlog
::
pattern_time_type
::
local
,
"
\n
"
)
==
"[pattern_tester ]"
" Some message
\n
"
);
}
TEST_CASE
(
"left_padded_max"
,
"[pattern_formatter]"
)
{
REQUIRE
(
log_to_str
(
"Some message"
,
"[%-128n] %v"
,
spdlog
::
pattern_time_type
::
local
,
"
\n
"
)
==
"[pattern_tester ]"
" Some message
\n
"
);
}
//
//TEST_CASE("right_padded_huge", "[pattern_formatter]")
//{
// REQUIRE(log_to_str("Some message", "[%-3n] %v", spdlog::pattern_time_type::local, "\n") == "[pattern_tester] Some message\n");
//}
//
//TEST_CASE("center_padded_huge", "[pattern_formatter]")
//{
// REQUIRE(log_to_str("Some message", "[%=3n] %v", spdlog::pattern_time_type::local, "\n") == "[pattern_tester] Some message\n");
//}
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