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
2375f2c6
Commit
2375f2c6
authored
Apr 13, 2013
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug where the string "null" (without quotes) is deserialized as a string, instead of null.
parent
e0ae477b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
src/singledocparser.cpp
+6
-0
test/core/parsertests.cpp
+13
-0
No files found.
src/singledocparser.cpp
View file @
2375f2c6
...
@@ -75,6 +75,12 @@ namespace YAML
...
@@ -75,6 +75,12 @@ namespace YAML
ParseProperties
(
tag
,
anchor
);
ParseProperties
(
tag
,
anchor
);
const
Token
&
token
=
m_scanner
.
peek
();
const
Token
&
token
=
m_scanner
.
peek
();
if
(
token
.
type
==
Token
::
PLAIN_SCALAR
&&
token
.
value
==
"null"
)
{
eventHandler
.
OnNull
(
mark
,
anchor
);
m_scanner
.
pop
();
return
;
}
// add non-specific tags
// add non-specific tags
if
(
tag
.
empty
())
if
(
tag
.
empty
())
...
...
test/core/parsertests.cpp
View file @
2375f2c6
...
@@ -28,6 +28,18 @@ namespace Test
...
@@ -28,6 +28,18 @@ namespace Test
EXPECT_DOC_END
();
EXPECT_DOC_END
();
DONE
();
DONE
();
}
}
TEST
NullStringScalar
()
{
HANDLE
(
"foo: null"
);
EXPECT_DOC_START
();
EXPECT_MAP_START
(
"?"
,
0
);
EXPECT_SCALAR
(
"?"
,
0
,
"foo"
);
EXPECT_NULL
(
0
);
EXPECT_MAP_END
();
EXPECT_DOC_END
();
DONE
();
}
}
}
namespace
{
namespace
{
...
@@ -57,6 +69,7 @@ namespace Test
...
@@ -57,6 +69,7 @@ namespace Test
int
total
=
0
;
int
total
=
0
;
RunParserTest
(
&
Parser
::
NoEndOfMapFlow
,
"No end of map flow"
,
passed
,
total
);
RunParserTest
(
&
Parser
::
NoEndOfMapFlow
,
"No end of map flow"
,
passed
,
total
);
RunParserTest
(
&
Parser
::
PlainScalarStartingWithQuestionMark
,
"Plain scalar starting with question mark"
,
passed
,
total
);
RunParserTest
(
&
Parser
::
PlainScalarStartingWithQuestionMark
,
"Plain scalar starting with question mark"
,
passed
,
total
);
RunParserTest
(
&
Parser
::
NullStringScalar
,
"Null string scalar"
,
passed
,
total
);
std
::
cout
<<
"Parser tests: "
<<
passed
<<
"/"
<<
total
<<
" passed
\n
"
;
std
::
cout
<<
"Parser tests: "
<<
passed
<<
"/"
<<
total
<<
" passed
\n
"
;
return
passed
==
total
;
return
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