Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
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
fmt
Commits
cc805c61
Commit
cc805c61
authored
Nov 08, 2018
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test enabled formatters
parent
e0157923
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
test/format-test.cc
test/format-test.cc
+18
-2
No files found.
test/format-test.cc
View file @
cc805c61
...
...
@@ -45,6 +45,22 @@ using testing::StrictMock;
namespace
{
template
<
typename
T
>
bool
check_enabled_formatter
()
{
static_assert
(
std
::
is_default_constructible
<
fmt
::
formatter
<
T
>>::
value
,
""
);
return
true
;
}
template
<
typename
...
T
>
void
check_enabled_formatters
()
{
auto
dummy
=
{
check_enabled_formatter
<
T
>
()...};
(
void
)
dummy
;
}
TEST
(
FormatterTest
,
TestFormattersEnabled
)
{
check_enabled_formatters
<
char
,
signed
char
,
unsigned
char
>
();
}
// Format value using the standard library.
template
<
typename
Char
,
typename
T
>
void
std_format
(
const
T
&
value
,
std
::
basic_string
<
Char
>
&
result
)
{
...
...
@@ -768,7 +784,7 @@ TEST(FormatterTest, ArgErrors) {
template
<
int
N
>
struct
TestFormat
{
template
<
typename
...
Args
>
static
std
::
string
format
(
fmt
::
string_view
format_str
,
const
Args
&
...
args
)
{
static
std
::
string
format
(
fmt
::
string_view
format_str
,
const
Args
&
...
args
)
{
return
TestFormat
<
N
-
1
>::
format
(
format_str
,
N
-
1
,
args
...);
}
};
...
...
@@ -776,7 +792,7 @@ struct TestFormat {
template
<
>
struct
TestFormat
<
0
>
{
template
<
typename
...
Args
>
static
std
::
string
format
(
fmt
::
string_view
format_str
,
const
Args
&
...
args
)
{
static
std
::
string
format
(
fmt
::
string_view
format_str
,
const
Args
&
...
args
)
{
return
fmt
::
format
(
format_str
,
args
...);
}
};
...
...
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