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
c67d701a
"configs/datasets/vscode:/vscode.git/clone" did not exist on "b7184e9db577a4ba391f5c33eb0a3f4e147204e1"
Commit
c67d701a
authored
Jan 25, 2024
by
Alejandro-FA
Committed by
Jesse Beder
Jan 26, 2024
Browse files
Fix indentation of empty sequences and add test
parent
9eb11429
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
src/emitter.cpp
src/emitter.cpp
+2
-1
test/integration/emitter_test.cpp
test/integration/emitter_test.cpp
+11
-0
No files found.
src/emitter.cpp
View file @
c67d701a
...
...
@@ -213,7 +213,8 @@ void Emitter::EmitEndSeq() {
if
(
m_pState
->
CurGroupFlowType
()
==
FlowType
::
Flow
)
{
if
(
m_stream
.
comment
())
m_stream
<<
"
\n
"
;
m_stream
<<
IndentTo
(
m_pState
->
CurIndent
());
if
(
originalType
==
FlowType
::
Block
||
m_pState
->
HasBegunNode
())
m_stream
<<
IndentTo
(
m_pState
->
CurIndent
());
if
(
originalType
==
FlowType
::
Block
)
{
m_stream
<<
"["
;
}
else
{
...
...
test/integration/emitter_test.cpp
View file @
c67d701a
...
...
@@ -176,6 +176,17 @@ TEST_F(EmitterTest, EmptyFlowSeqWithBegunContent) {
]])"
);
}
TEST_F
(
EmitterTest
,
EmptyFlowSeqInMap
)
{
out
<<
BeginMap
;
out
<<
Key
<<
Flow
<<
BeginSeq
<<
EndSeq
;
out
<<
Value
<<
1
;
out
<<
Key
<<
2
;
out
<<
Value
<<
Flow
<<
BeginSeq
<<
EndSeq
;
out
<<
EndMap
;
ExpectEmit
(
"[]: 1
\n
2: []"
);
}
TEST_F
(
EmitterTest
,
EmptyFlowMapWithBegunContent
)
{
out
<<
Flow
;
out
<<
BeginSeq
;
...
...
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