Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
test262
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pmaksimo
test262
Commits
43acf615
Commit
43acf615
authored
9 years ago
by
Brian Terlson
Browse files
Options
Downloads
Plain Diff
Merge pull request #216 from smikes/215-indented-yaml
candidate fix for #215
parents
2b033968
107d786e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/packaging/monkeyYaml.py
+1
-1
1 addition, 1 deletion
tools/packaging/monkeyYaml.py
tools/packaging/test/test_monkeyYaml.py
+43
-4
43 additions, 4 deletions
tools/packaging/test/test_monkeyYaml.py
with
44 additions
and
5 deletions
tools/packaging/monkeyYaml.py
+
1
−
1
View file @
43acf615
...
...
@@ -90,7 +90,7 @@ def myFlowList(value):
def
myMultiline
(
lines
,
value
):
# assume no explcit indentor (otherwise have to parse value)
value
=
[]
indent
=
1
indent
=
myLeadingSpaces
(
lines
[
0
])
while
lines
:
line
=
lines
.
pop
(
0
)
if
myIsAllSpaces
(
line
):
...
...
This diff is collapsed.
Click to expand it.
tools/packaging/test/test_monkeyYaml.py
+
43
−
4
View file @
43acf615
...
...
@@ -58,7 +58,7 @@ class TestMonkeyYAMLParsing(unittest.TestCase):
self
.
assertEqual
(
lines
,
[])
self
.
assertEqual
(
value
,
yaml
.
load
(
y
))
def
test_Multiline_
1
(
self
):
def
test_Multiline_
2
(
self
):
lines
=
[
"
foo
"
,
"
bar
"
]
value
=
"
>
"
y
=
"
\n
"
.
join
([
value
]
+
lines
)
...
...
@@ -66,6 +66,21 @@ class TestMonkeyYAMLParsing(unittest.TestCase):
self
.
assertEqual
(
lines
,
[])
self
.
assertEqual
(
value
,
yaml
.
load
(
y
))
def
test_Multiline_3
(
self
):
lines
=
[
"
foo
"
,
"
bar
"
]
value
=
"
>
"
y
=
"
\n
"
.
join
([
value
]
+
lines
)
(
lines
,
value
)
=
monkeyYaml
.
myMultiline
(
lines
,
value
)
self
.
assertEqual
(
lines
,
[])
self
.
assertEqual
(
value
,
yaml
.
load
(
y
))
def
test_Multiline_4
(
self
):
lines
=
[
"
foo
"
,
"
bar
"
,
"
other: 42
"
]
value
=
"
>
"
(
lines
,
value
)
=
monkeyYaml
.
myMultiline
(
lines
,
value
)
self
.
assertEqual
(
lines
,
[
"
other: 42
"
])
self
.
assertEqual
(
value
,
"
foo bar
"
)
def
test_myLeading
(
self
):
self
.
assertEqual
(
2
,
monkeyYaml
.
myLeadingSpaces
(
"
foo
"
))
self
.
assertEqual
(
2
,
monkeyYaml
.
myLeadingSpaces
(
"
"
))
...
...
@@ -83,15 +98,39 @@ class TestMonkeyYAMLParsing(unittest.TestCase):
y
=
"
foo:
\n
- bar
\n
- baz
"
self
.
assertEqual
(
monkeyYaml
.
load
(
y
),
yaml
.
load
(
y
))
def
test_muli
ne
line_list2
(
self
):
def
test_mul
t
iline_list2
(
self
):
self
.
assertEqual
(
monkeyYaml
.
myRemoveListHeader
(
2
,
"
- foo
"
),
"
foo
"
)
def
test_muli
ne
line_list3
(
self
):
def
test_mul
t
iline_list3
(
self
):
(
lines
,
value
)
=
monkeyYaml
.
myMultilineList
([
"
- foo
"
,
"
- bar
"
,
"
baz: bletch
"
],
""
)
self
.
assertEqual
(
lines
,
[
"
baz: bletch
"
])
self
.
assertEqual
(
value
,
[
"
foo
"
,
"
bar
"
])
def
test_oneline_indented
(
self
):
y
=
"
foo: bar
\n
baz: baf
\n
"
self
.
assertEqual
(
monkeyYaml
.
load
(
y
),
yaml
.
load
(
y
))
def
test_indentation_215
(
self
):
self
.
maxDiff
=
None
y
=
"""
description: >
The method should exist on the Array prototype, and it should be writable
and configurable, but not enumerable.
includes: [propertyHelper.js]
es6id: 22.1.3.13
"""
self
.
assertEqual
(
monkeyYaml
.
load
(
y
),
yaml
.
load
(
y
))
def
test_indentation_215_2
(
self
):
self
.
maxDiff
=
None
y
=
"""
description: >
The method should exist
includes: [propertyHelper.js]
es6id: 22.1.3.13
"""
self
.
assertEqual
(
monkeyYaml
.
load
(
y
),
yaml
.
load
(
y
))
if
__name__
==
'
__main__
'
:
unittest
.
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment