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
1b50109f
Unverified
Commit
1b50109f
authored
Oct 05, 2022
by
James Brown
Committed by
GitHub
Oct 04, 2022
Browse files
Include property nodes in the long key check (#1140)
parent
4ae4cb73
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
src/emitter.cpp
src/emitter.cpp
+2
-1
test/integration/emitter_test.cpp
test/integration/emitter_test.cpp
+33
-1
No files found.
src/emitter.cpp
View file @
1b50109f
...
@@ -533,7 +533,8 @@ void Emitter::BlockMapPrepareNode(EmitterNodeType::value child) {
...
@@ -533,7 +533,8 @@ void Emitter::BlockMapPrepareNode(EmitterNodeType::value child) {
if
(
m_pState
->
GetMapKeyFormat
()
==
LongKey
)
if
(
m_pState
->
GetMapKeyFormat
()
==
LongKey
)
m_pState
->
SetLongKey
();
m_pState
->
SetLongKey
();
if
(
child
==
EmitterNodeType
::
BlockSeq
||
if
(
child
==
EmitterNodeType
::
BlockSeq
||
child
==
EmitterNodeType
::
BlockMap
)
child
==
EmitterNodeType
::
BlockMap
||
child
==
EmitterNodeType
::
Property
)
m_pState
->
SetLongKey
();
m_pState
->
SetLongKey
();
if
(
m_pState
->
CurGroupLongKey
())
if
(
m_pState
->
CurGroupLongKey
())
...
...
test/integration/emitter_test.cpp
View file @
1b50109f
...
@@ -431,6 +431,38 @@ TEST_F(EmitterTest, BlockMapAsKey) {
...
@@ -431,6 +431,38 @@ TEST_F(EmitterTest, BlockMapAsKey) {
ExpectEmit
(
"? key: value
\n
next key: next value
\n
: total value"
);
ExpectEmit
(
"? key: value
\n
next key: next value
\n
: total value"
);
}
}
TEST_F
(
EmitterTest
,
TaggedBlockMapAsKey
)
{
out
<<
BeginMap
;
out
<<
Key
;
out
<<
LocalTag
(
"innerMap"
);
out
<<
BeginMap
;
out
<<
Key
<<
"key"
<<
Value
<<
"value"
;
out
<<
EndMap
;
out
<<
Value
;
out
<<
"outerValue"
;
out
<<
EndMap
;
ExpectEmit
(
R"(? !innerMap
key: value
: outerValue)"
);
}
TEST_F
(
EmitterTest
,
TaggedBlockListAsKey
)
{
out
<<
BeginMap
;
out
<<
Key
;
out
<<
LocalTag
(
"innerList"
);
out
<<
BeginSeq
;
out
<<
"listItem"
;
out
<<
EndSeq
;
out
<<
Value
;
out
<<
"outerValue"
;
out
<<
EndMap
;
ExpectEmit
(
R"(? !innerList
- listItem
: outerValue)"
);
}
TEST_F
(
EmitterTest
,
AliasAndAnchor
)
{
TEST_F
(
EmitterTest
,
AliasAndAnchor
)
{
out
<<
BeginSeq
;
out
<<
BeginSeq
;
out
<<
Anchor
(
"fred"
);
out
<<
Anchor
(
"fred"
);
...
@@ -520,7 +552,7 @@ TEST_F(EmitterTest, VerbatimTagInBlockMap) {
...
@@ -520,7 +552,7 @@ TEST_F(EmitterTest, VerbatimTagInBlockMap) {
out
<<
Value
<<
VerbatimTag
(
"!waz"
)
<<
"baz"
;
out
<<
Value
<<
VerbatimTag
(
"!waz"
)
<<
"baz"
;
out
<<
EndMap
;
out
<<
EndMap
;
ExpectEmit
(
"!<!foo> bar: !<!waz> baz"
);
ExpectEmit
(
"
?
!<!foo> bar
\n
: !<!waz> baz"
);
}
}
TEST_F
(
EmitterTest
,
VerbatimTagInFlowMap
)
{
TEST_F
(
EmitterTest
,
VerbatimTagInFlowMap
)
{
...
...
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