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
1ab9469f
Commit
1ab9469f
authored
May 23, 2012
by
Jesse Beder
Browse files
Added map/seq gen emitter tests, including some failing ones
parent
3ddfeff4
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3853 additions
and
0 deletions
+3853
-0
test/create-emitter-tests.py
test/create-emitter-tests.py
+27
-0
test/genemittertests.h
test/genemittertests.h
+3826
-0
No files found.
test/create-emitter-tests.py
View file @
1ab9469f
...
...
@@ -68,6 +68,22 @@ def seq_start(tag='', anchor='', anchor_id=0):
def
seq_end
():
return
{
'emit'
:
'YAML::EndSeq'
,
'handle'
:
'SEQ_END()'
}
def
map_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::BeginMap'
]
return
{
'emit'
:
emit
,
'handle'
:
'MAP_START("%s", %s)'
%
(
out_tag
,
anchor_id
)}
def
map_end
():
return
{
'emit'
:
'YAML::EndMap'
,
'handle'
:
'MAP_END()'
}
def
gen_templates
():
yield
[[
doc_start
(),
doc_start
(
True
)],
[
scalar
(
'foo'
),
scalar
(
'foo
\n
'
),
scalar
(
'foo'
,
'tag'
),
scalar
(
'foo'
,
''
,
'anchor'
,
1
)],
...
...
@@ -77,6 +93,17 @@ def gen_templates():
[[],
[
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
)]]
yield
[[
doc_start
(),
doc_start
(
True
)],
[
map_start
()],
[[],
[
scalar
(
'foo'
),
scalar
(
'bar'
)],
[
scalar
(
'foo'
,
'tag'
,
'anchor'
,
1
),
scalar
(
'bar'
,
'tag'
,
'other'
,
2
)]],
[
map_end
()],
[
doc_end
(),
doc_end
(
True
)]]
yield
[[
doc_start
(
True
)],
[
map_start
()],
[[
scalar
(
'foo'
)],
[
seq_start
(),
scalar
(
'foo'
),
seq_end
()],
[
map_start
(),
scalar
(
'foo'
),
scalar
(
'bar'
),
map_end
()]],
[[
scalar
(
'foo'
)],
[
seq_start
(),
scalar
(
'foo'
),
seq_end
()],
[
map_start
(),
scalar
(
'foo'
),
scalar
(
'bar'
),
map_end
()]],
[
map_end
()],
[
doc_end
(
True
)]]
def
expand
(
template
):
if
len
(
template
)
==
0
:
...
...
test/genemittertests.h
View file @
1ab9469f
This diff is collapsed.
Click to expand it.
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