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
1da813f5
Commit
1da813f5
authored
Oct 12, 2024
by
IMaloney
Committed by
Jesse Beder
Dec 17, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensuring local tags are retained after loading a node + test
parent
f878043f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletions
+17
-1
src/emitfromevents.cpp
+6
-1
test/integration/emitter_test.cpp
+11
-0
No files found.
src/emitfromevents.cpp
View file @
1da813f5
...
@@ -116,8 +116,13 @@ void EmitFromEvents::BeginNode() {
...
@@ -116,8 +116,13 @@ void EmitFromEvents::BeginNode() {
}
}
void
EmitFromEvents
::
EmitProps
(
const
std
::
string
&
tag
,
anchor_t
anchor
)
{
void
EmitFromEvents
::
EmitProps
(
const
std
::
string
&
tag
,
anchor_t
anchor
)
{
if
(
!
tag
.
empty
()
&&
tag
!=
"?"
&&
tag
!=
"!"
)
if
(
!
tag
.
empty
()
&&
tag
!=
"?"
&&
tag
!=
"!"
){
if
(
tag
[
0
]
==
'!'
)
{
m_emitter
<<
LocalTag
(
std
::
string
(
tag
.
begin
()
+
1
,
tag
.
end
()));
}
else
{
m_emitter
<<
VerbatimTag
(
tag
);
m_emitter
<<
VerbatimTag
(
tag
);
}
}
if
(
anchor
)
if
(
anchor
)
m_emitter
<<
Anchor
(
ToString
(
anchor
));
m_emitter
<<
Anchor
(
ToString
(
anchor
));
}
}
...
...
test/integration/emitter_test.cpp
View file @
1da813f5
...
@@ -629,6 +629,17 @@ TEST_F(EmitterTest, LocalTagWithScalar) {
...
@@ -629,6 +629,17 @@ TEST_F(EmitterTest, LocalTagWithScalar) {
ExpectEmit
(
"!foo bar"
);
ExpectEmit
(
"!foo bar"
);
}
}
TEST_F
(
EmitterTest
,
LocalTagRetainedAfterLoadingNode
)
{
Node
n
=
Node
(
"hello"
);
out
<<
LocalTag
(
"foo"
)
<<
n
;
std
::
string
expected
=
"!foo hello"
;
ExpectEmit
(
expected
);
Node
yamlNode
=
Load
(
out
.
c_str
());
Emitter
emitter
;
emitter
<<
yamlNode
;
EXPECT_EQ
(
expected
,
emitter
.
c_str
());
}
TEST_F
(
EmitterTest
,
ComplexDoc
)
{
TEST_F
(
EmitterTest
,
ComplexDoc
)
{
out
<<
BeginMap
;
out
<<
BeginMap
;
out
<<
Key
<<
"receipt"
;
out
<<
Key
<<
"receipt"
;
...
...
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