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
74dc571b
Commit
74dc571b
authored
Sep 30, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support signed char and unsigned char strings
parent
98a25ec7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
format.h
format.h
+4
-0
test/format-test.cc
test/format-test.cc
+14
-0
No files found.
format.h
View file @
74dc571b
...
...
@@ -651,6 +651,8 @@ struct Value {
long
double
long_double_value
;
const
void
*
pointer
;
StringValue
<
char
>
string
;
StringValue
<
signed
char
>
sstring
;
StringValue
<
unsigned
char
>
ustring
;
StringValue
<
wchar_t
>
wstring
;
CustomValue
custom
;
};
...
...
@@ -758,6 +760,8 @@ public:
FMT_MAKE_VALUE
(
char
*
,
string
.
value
,
CSTRING
)
FMT_MAKE_VALUE
(
const
char
*
,
string
.
value
,
CSTRING
)
FMT_MAKE_VALUE
(
const
signed
char
*
,
sstring
.
value
,
CSTRING
)
FMT_MAKE_VALUE
(
const
unsigned
char
*
,
ustring
.
value
,
CSTRING
)
FMT_MAKE_STR_VALUE
(
const
std
::
string
&
,
STRING
)
FMT_MAKE_STR_VALUE
(
StringRef
,
STRING
)
...
...
test/format-test.cc
View file @
74dc571b
...
...
@@ -1170,6 +1170,20 @@ TEST(FormatterTest, FormatCString) {
FormatError
,
"string pointer is null"
);
}
TEST
(
FormatterTest
,
FormatSCharString
)
{
signed
char
str
[]
=
"test"
;
EXPECT_EQ
(
"test"
,
format
(
"{0:s}"
,
str
));
const
signed
char
*
const_str
=
str
;
EXPECT_EQ
(
"test"
,
format
(
"{0:s}"
,
const_str
));
}
TEST
(
FormatterTest
,
FormatUCharString
)
{
unsigned
char
str
[]
=
"test"
;
EXPECT_EQ
(
"test"
,
format
(
"{0:s}"
,
str
));
const
unsigned
char
*
const_str
=
str
;
EXPECT_EQ
(
"test"
,
format
(
"{0:s}"
,
const_str
));
}
TEST
(
FormatterTest
,
FormatPointer
)
{
check_unknown_types
(
reinterpret_cast
<
void
*>
(
0x1234
),
"p"
,
"pointer"
);
EXPECT_EQ
(
"0x0"
,
format
(
"{0}"
,
reinterpret_cast
<
void
*>
(
0
)));
...
...
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