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
0d41a7de
Commit
0d41a7de
authored
Aug 26, 2009
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added more explicit doc indicator tests
parent
1b240d35
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
0 deletions
+73
-0
yaml-reader/parsertests.cpp
+69
-0
yaml-reader/tests.cpp
+2
-0
yaml-reader/tests.h
+2
-0
No files found.
yaml-reader/parsertests.cpp
View file @
0d41a7de
...
@@ -418,5 +418,74 @@ namespace Test
...
@@ -418,5 +418,74 @@ namespace Test
return
true
;
return
true
;
}
}
bool
ExplicitEndDoc
()
{
std
::
string
input
=
"- one
\n
- two
\n
...
\n
..."
;
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
MultipleDocsWithSomeExplicitIndicators
()
{
std
::
string
input
=
"- one
\n
- two
\n
...
\n
"
"---
\n
key: value
\n
...
\n
...
\n
"
"- three
\n
- four
\n
"
"---
\n
key: value"
;
std
::
stringstream
stream
(
input
);
YAML
::
Parser
parser
(
stream
);
YAML
::
Node
doc
;
std
::
string
output
;
parser
.
GetNextDocument
(
doc
);
if
(
doc
.
size
()
!=
2
)
return
false
;
doc
[
0
]
>>
output
;
if
(
output
!=
"one"
)
return
false
;
doc
[
1
]
>>
output
;
if
(
output
!=
"two"
)
return
false
;
parser
.
GetNextDocument
(
doc
);
doc
[
"key"
]
>>
output
;
if
(
output
!=
"value"
)
return
false
;
parser
.
GetNextDocument
(
doc
);
if
(
doc
.
size
()
!=
2
)
return
false
;
doc
[
0
]
>>
output
;
if
(
output
!=
"three"
)
return
false
;
doc
[
1
]
>>
output
;
if
(
output
!=
"four"
)
return
false
;
parser
.
GetNextDocument
(
doc
);
doc
[
"key"
]
>>
output
;
if
(
output
!=
"value"
)
return
false
;
return
true
;
}
}
}
}
}
yaml-reader/tests.cpp
View file @
0d41a7de
...
@@ -271,6 +271,8 @@ namespace Test
...
@@ -271,6 +271,8 @@ namespace Test
RunParserTest
(
&
Parser
::
AliasWithNull
,
"alias with null"
,
passed
);
RunParserTest
(
&
Parser
::
AliasWithNull
,
"alias with null"
,
passed
);
RunParserTest
(
&
Parser
::
ExplicitDoc
,
"explicit doc"
,
passed
);
RunParserTest
(
&
Parser
::
ExplicitDoc
,
"explicit doc"
,
passed
);
RunParserTest
(
&
Parser
::
MultipleDocs
,
"multiple docs"
,
passed
);
RunParserTest
(
&
Parser
::
MultipleDocs
,
"multiple docs"
,
passed
);
RunParserTest
(
&
Parser
::
ExplicitEndDoc
,
"explicit end doc"
,
passed
);
RunParserTest
(
&
Parser
::
MultipleDocsWithSomeExplicitIndicators
,
"multiple docs with some explicit indicators"
,
passed
);
RunEncodingTest
(
&
EncodeToUtf8
,
false
,
"UTF-8, no BOM"
,
passed
);
RunEncodingTest
(
&
EncodeToUtf8
,
false
,
"UTF-8, no BOM"
,
passed
);
RunEncodingTest
(
&
EncodeToUtf8
,
true
,
"UTF-8 with BOM"
,
passed
);
RunEncodingTest
(
&
EncodeToUtf8
,
true
,
"UTF-8 with BOM"
,
passed
);
...
...
yaml-reader/tests.h
View file @
0d41a7de
...
@@ -42,6 +42,8 @@ namespace Test {
...
@@ -42,6 +42,8 @@ namespace Test {
bool
AliasWithNull
();
bool
AliasWithNull
();
bool
ExplicitDoc
();
bool
ExplicitDoc
();
bool
MultipleDocs
();
bool
MultipleDocs
();
bool
ExplicitEndDoc
();
bool
MultipleDocsWithSomeExplicitIndicators
();
}
}
namespace
Emitter
{
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