Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
ac3d95f4
Commit
ac3d95f4
authored
Dec 02, 2009
by
jbeder
Browse files
Added test for duplicate key
parent
f4b81e73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
test/parsertests.cpp
test/parsertests.cpp
+18
-0
No files found.
test/parsertests.cpp
View file @
ac3d95f4
...
...
@@ -689,6 +689,23 @@ namespace Test
return
true
;
}
bool
DuplicateKey
()
{
std
::
string
input
=
"{a: 1, b: 2, c: 3, a: 4}"
;
std
::
stringstream
stream
(
input
);
YAML
::
Parser
parser
(
stream
);
YAML
::
Node
doc
;
parser
.
GetNextDocument
(
doc
);
if
(
doc
[
"a"
]
!=
1
)
return
false
;
if
(
doc
[
"b"
]
!=
2
)
return
false
;
if
(
doc
[
"c"
]
!=
3
)
return
false
;
return
true
;
}
}
namespace
{
...
...
@@ -951,6 +968,7 @@ namespace Test
RunParserTest
(
&
Parser
::
BlockKeyWithNullValue
,
"block key with null value"
,
passed
,
total
);
RunParserTest
(
&
Parser
::
Bases
,
"bases"
,
passed
,
total
);
RunParserTest
(
&
Parser
::
KeyNotFound
,
"key not found"
,
passed
,
total
);
RunParserTest
(
&
Parser
::
DuplicateKey
,
"duplicate key"
,
passed
,
total
);
RunEncodingTest
(
&
EncodeToUtf8
,
false
,
"UTF-8, no BOM"
,
passed
,
total
);
RunEncodingTest
(
&
EncodeToUtf8
,
true
,
"UTF-8 with BOM"
,
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