Skip to content

Commit a67a696

Browse files
author
Issac Trotts
committed
Prevent str() making strs parse() can't handle
No longer prevent making long lines.
1 parent 4f982d7 commit a67a696

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

cmakelists_parsing/parsing.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def parse(s, path='<string>'):
5555
def strip_blanks(tree):
5656
return File([x for x in tree if not isinstance(x, BlankLine)])
5757

58-
def compose_lines(tree, max_width=79):
58+
def compose_lines(tree):
5959
"""
6060
Yields pretty-printed lines of a CMakeLists file.
6161
"""
@@ -73,12 +73,7 @@ def compose_lines(tree, max_width=79):
7373
for i, line in enumerate(command_to_lines(item)):
7474
offset = 1 if i > 0 else 0
7575
line2 = (level + offset) * tab + line
76-
if len(line2) <= max_width:
77-
yield line2
78-
else:
79-
# Line is too long. Try again.
80-
for _, (ty, contents) in tokenize(line):
81-
yield (level + offset) * tab + contents
76+
yield line2
8277

8378
if name in ('function', 'macro', 'if', 'else'):
8479
level += 1

tests/example_inputs_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class ExamplesTestCase(unittest.TestCase):
1616
def test_idempotency_of_parse_unparse(self):
1717
round_trip = lambda s, path='<string>': str(cmp.parse(s, path))
1818
for path, contents in yield_examples():
19+
print 'Testing on %s' % path
1920
self.assertEqual(round_trip(contents, path),
2021
round_trip(round_trip(contents, path)),
2122
'Failed on %s' % path)

0 commit comments

Comments
 (0)