Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yaml-cpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
yaml-cpp
Commits
086fec5c
Commit
086fec5c
authored
Oct 11, 2016
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix formatting when writing \ as a character.
parent
85af926d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
src/emitterutils.cpp
+2
-0
test/integration/emitter_test.cpp
+8
-0
No files found.
src/emitterutils.cpp
View file @
086fec5c
...
@@ -380,6 +380,8 @@ bool WriteChar(ostream_wrapper& out, char ch) {
...
@@ -380,6 +380,8 @@ bool WriteChar(ostream_wrapper& out, char ch) {
out
<<
"
\"\\
n
\"
"
;
out
<<
"
\"\\
n
\"
"
;
}
else
if
(
ch
==
'\b'
)
{
}
else
if
(
ch
==
'\b'
)
{
out
<<
"
\"\\
b
\"
"
;
out
<<
"
\"\\
b
\"
"
;
}
else
if
(
ch
==
'\\'
)
{
out
<<
"
\"\\\\\"
"
;
}
else
if
((
0x20
<=
ch
&&
ch
<=
0x7e
)
||
ch
==
' '
)
{
}
else
if
((
0x20
<=
ch
&&
ch
<=
0x7e
)
||
ch
==
' '
)
{
out
<<
"
\"
"
<<
ch
<<
"
\"
"
;
out
<<
"
\"
"
<<
ch
<<
"
\"
"
;
}
else
{
}
else
{
...
...
test/integration/emitter_test.cpp
View file @
086fec5c
...
@@ -970,6 +970,14 @@ TEST_F(EmitterTest, ValueOfDoubleQuote) {
...
@@ -970,6 +970,14 @@ TEST_F(EmitterTest, ValueOfDoubleQuote) {
ExpectEmit
(
"foo:
\"\\\"\"
"
);
ExpectEmit
(
"foo:
\"\\\"\"
"
);
}
}
TEST_F
(
EmitterTest
,
ValueOfBackslash
)
{
out
<<
YAML
::
BeginMap
;
out
<<
YAML
::
Key
<<
"foo"
<<
YAML
::
Value
<<
'\\'
;
out
<<
YAML
::
EndMap
;
ExpectEmit
(
"foo:
\"\\\\\"
"
);
}
class
EmitterErrorTest
:
public
::
testing
::
Test
{
class
EmitterErrorTest
:
public
::
testing
::
Test
{
protected
:
protected
:
void
ExpectEmitError
(
const
std
::
string
&
expectedError
)
{
void
ExpectEmitError
(
const
std
::
string
&
expectedError
)
{
...
...
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