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
7e129c9b
Commit
7e129c9b
authored
Sep 06, 2011
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed empty string emitter bug (it now with auto-quote it
parent
3e94c0a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
src/emitterutils.cpp
+3
-0
test/emittertests.cpp
+9
-0
No files found.
src/emitterutils.cpp
View file @
7e129c9b
...
@@ -128,6 +128,9 @@ namespace YAML
...
@@ -128,6 +128,9 @@ namespace YAML
}
}
bool
IsValidPlainScalar
(
const
std
::
string
&
str
,
bool
inFlow
,
bool
allowOnlyAscii
)
{
bool
IsValidPlainScalar
(
const
std
::
string
&
str
,
bool
inFlow
,
bool
allowOnlyAscii
)
{
if
(
str
.
empty
())
return
false
;
// first check the start
// first check the start
const
RegEx
&
start
=
(
inFlow
?
Exp
::
PlainScalarInFlow
()
:
Exp
::
PlainScalar
());
const
RegEx
&
start
=
(
inFlow
?
Exp
::
PlainScalarInFlow
()
:
Exp
::
PlainScalar
());
if
(
!
start
.
Matches
(
str
))
if
(
!
start
.
Matches
(
str
))
...
...
test/emittertests.cpp
View file @
7e129c9b
...
@@ -846,6 +846,14 @@ namespace Test
...
@@ -846,6 +846,14 @@ namespace Test
out
<<
"Oops"
;
out
<<
"Oops"
;
desiredOutput
=
"Hi
\n
---
\n
Bye
\n
---
\n
Oops"
;
desiredOutput
=
"Hi
\n
---
\n
Bye
\n
---
\n
Oops"
;
}
}
void
EmptyString
(
YAML
::
Emitter
&
out
,
std
::
string
&
desiredOutput
)
{
out
<<
YAML
::
BeginMap
;
out
<<
YAML
::
Key
<<
"key"
<<
YAML
::
Value
<<
""
;
out
<<
YAML
::
EndMap
;
desiredOutput
=
"key:
\"\"
"
;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
// incorrect emitting
// incorrect emitting
...
@@ -1058,6 +1066,7 @@ namespace Test
...
@@ -1058,6 +1066,7 @@ namespace Test
RunEmitterTest
(
&
Emitter
::
BoolFormatting
,
"bool formatting"
,
passed
,
total
);
RunEmitterTest
(
&
Emitter
::
BoolFormatting
,
"bool formatting"
,
passed
,
total
);
RunEmitterTest
(
&
Emitter
::
DocStartAndEnd
,
"doc start and end"
,
passed
,
total
);
RunEmitterTest
(
&
Emitter
::
DocStartAndEnd
,
"doc start and end"
,
passed
,
total
);
RunEmitterTest
(
&
Emitter
::
ImplicitDocStart
,
"implicit doc start"
,
passed
,
total
);
RunEmitterTest
(
&
Emitter
::
ImplicitDocStart
,
"implicit doc start"
,
passed
,
total
);
RunEmitterTest
(
&
Emitter
::
EmptyString
,
"empty string"
,
passed
,
total
);
RunEmitterErrorTest
(
&
Emitter
::
ExtraEndSeq
,
"extra EndSeq"
,
passed
,
total
);
RunEmitterErrorTest
(
&
Emitter
::
ExtraEndSeq
,
"extra EndSeq"
,
passed
,
total
);
RunEmitterErrorTest
(
&
Emitter
::
ExtraEndMap
,
"extra EndMap"
,
passed
,
total
);
RunEmitterErrorTest
(
&
Emitter
::
ExtraEndMap
,
"extra EndMap"
,
passed
,
total
);
...
...
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