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
1b240d35
Commit
1b240d35
authored
Aug 26, 2009
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug with explicit doc start introduced in last commit
parent
4b6a0b38
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
2 deletions
+59
-2
src/scanner.cpp
+7
-2
yaml-reader/parsertests.cpp
+48
-0
yaml-reader/tests.cpp
+2
-0
yaml-reader/tests.h
+2
-0
No files found.
src/scanner.cpp
View file @
1b240d35
...
...
@@ -294,7 +294,7 @@ namespace YAML
}
// PopAllIndents
// . Pops all indentations off the stack,
// . Pops all indentations
(except for the base empty one)
off the stack,
// and enqueues the proper token each time.
void
Scanner
::
PopAllIndents
()
{
...
...
@@ -303,8 +303,13 @@ namespace YAML
return
;
// now pop away
while
(
!
m_indents
.
empty
())
while
(
!
m_indents
.
empty
())
{
const
IndentMarker
&
indent
=
m_indents
.
top
();
if
(
indent
.
type
==
IndentMarker
::
NONE
)
break
;
PopIndent
();
}
}
// PopIndent
...
...
yaml-reader/parsertests.cpp
View file @
1b240d35
...
...
@@ -370,5 +370,53 @@ namespace Test
return
true
;
}
bool
ExplicitDoc
()
{
std
::
string
input
=
"---
\n
- one
\n
- two"
;
std
::
stringstream
stream
(
input
);
YAML
::
Parser
parser
(
stream
);
YAML
::
Node
doc
;
parser
.
GetNextDocument
(
doc
);
if
(
doc
.
size
()
!=
2
)
return
false
;
std
::
string
output
;
doc
[
0
]
>>
output
;
if
(
output
!=
"one"
)
return
false
;
doc
[
1
]
>>
output
;
if
(
output
!=
"two"
)
return
false
;
return
true
;
}
bool
MultipleDocs
()
{
std
::
string
input
=
"---
\n
name: doc1
\n
---
\n
name: doc2"
;
std
::
stringstream
stream
(
input
);
YAML
::
Parser
parser
(
stream
);
YAML
::
Node
doc
;
parser
.
GetNextDocument
(
doc
);
std
::
string
output
;
doc
[
"name"
]
>>
output
;
if
(
output
!=
"doc1"
)
return
false
;
if
(
!
parser
)
return
false
;
parser
.
GetNextDocument
(
doc
);
doc
[
"name"
]
>>
output
;
if
(
output
!=
"doc2"
)
return
false
;
return
true
;
}
}
}
yaml-reader/tests.cpp
View file @
1b240d35
...
...
@@ -269,6 +269,8 @@ namespace Test
RunParserTest
(
&
Parser
::
NullBlockMapValue
,
"null block map value"
,
passed
);
RunParserTest
(
&
Parser
::
SimpleAlias
,
"simple alias"
,
passed
);
RunParserTest
(
&
Parser
::
AliasWithNull
,
"alias with null"
,
passed
);
RunParserTest
(
&
Parser
::
ExplicitDoc
,
"explicit doc"
,
passed
);
RunParserTest
(
&
Parser
::
MultipleDocs
,
"multiple docs"
,
passed
);
RunEncodingTest
(
&
EncodeToUtf8
,
false
,
"UTF-8, no BOM"
,
passed
);
RunEncodingTest
(
&
EncodeToUtf8
,
true
,
"UTF-8 with BOM"
,
passed
);
...
...
yaml-reader/tests.h
View file @
1b240d35
...
...
@@ -40,6 +40,8 @@ namespace Test {
bool
NullBlockMapValue
();
bool
SimpleAlias
();
bool
AliasWithNull
();
bool
ExplicitDoc
();
bool
MultipleDocs
();
}
namespace
Emitter
{
...
...
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