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
3ddfeff4
Commit
3ddfeff4
authored
May 23, 2012
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added seq gen emitter tests
parent
fdfffb09
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3676 additions
and
1 deletions
+3676
-1
test/create-emitter-tests.py
+24
-1
test/genemittertests.h
+3652
-0
No files found.
test/create-emitter-tests.py
View file @
3ddfeff4
...
@@ -52,8 +52,31 @@ def scalar(value, tag='', anchor='', anchor_id=0):
...
@@ -52,8 +52,31 @@ def scalar(value, tag='', anchor='', anchor_id=0):
def
comment
(
value
):
def
comment
(
value
):
return
{
'emit'
:
'YAML::Comment("
%
s")'
%
value
,
'handle'
:
''
}
return
{
'emit'
:
'YAML::Comment("
%
s")'
%
value
,
'handle'
:
''
}
def
seq_start
(
tag
=
''
,
anchor
=
''
,
anchor_id
=
0
):
emit
=
[]
if
tag
:
emit
+=
[
'YAML::VerbatimTag("
%
s")'
%
encode
(
tag
)]
if
anchor
:
emit
+=
[
'YAML::Anchor("
%
s")'
%
encode
(
anchor
)]
if
tag
:
out_tag
=
encode
(
tag
)
else
:
out_tag
=
'?'
emit
+=
[
'YAML::BeginSeq'
]
return
{
'emit'
:
emit
,
'handle'
:
'SEQ_START("
%
s",
%
s)'
%
(
out_tag
,
anchor_id
)}
def
seq_end
():
return
{
'emit'
:
'YAML::EndSeq'
,
'handle'
:
'SEQ_END()'
}
def
gen_templates
():
def
gen_templates
():
yield
[[
doc_start
(),
doc_start
(
True
)],
[
scalar
(
'foo'
),
scalar
(
'foo
\n
'
)],
[
doc_end
(),
doc_end
(
True
)]]
yield
[[
doc_start
(),
doc_start
(
True
)],
[
scalar
(
'foo'
),
scalar
(
'foo
\n
'
),
scalar
(
'foo'
,
'tag'
),
scalar
(
'foo'
,
''
,
'anchor'
,
1
)],
[
doc_end
(),
doc_end
(
True
)]]
yield
[[
doc_start
(),
doc_start
(
True
)],
[
seq_start
()],
[[],
[
scalar
(
'foo'
)],
[
scalar
(
'foo'
,
'tag'
)],
[
scalar
(
'foo'
,
''
,
'anchor'
,
1
)],
[
scalar
(
'foo'
,
'tag'
,
'anchor'
,
1
)],
[
scalar
(
'foo'
),
scalar
(
'bar'
)],
[
scalar
(
'foo'
,
'tag'
,
'anchor'
,
1
),
scalar
(
'bar'
,
'tag'
,
'other'
,
2
)]],
[
seq_end
()],
[
doc_end
(),
doc_end
(
True
)]]
def
expand
(
template
):
def
expand
(
template
):
if
len
(
template
)
==
0
:
if
len
(
template
)
==
0
:
...
...
test/genemittertests.h
View file @
3ddfeff4
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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