summaryrefslogtreecommitdiffstats
path: root/misc/ninja_syntax_test.py
diff options
context:
space:
mode:
authorAlex Vallée <avallee@google.com>2015-10-23 20:36:28 (GMT)
committerAlex Vallée <avallee@google.com>2015-10-23 20:36:28 (GMT)
commit8f658d63298c5fae29616b8d922d03bb7ea67c0c (patch)
tree3dd0d2c40c09c075d663428628ad094d611890c3 /misc/ninja_syntax_test.py
parent083b6b040681ec3d8ec3cd40f20406b9e6ec8d56 (diff)
downloadNinja-8f658d63298c5fae29616b8d922d03bb7ea67c0c.zip
Ninja-8f658d63298c5fae29616b8d922d03bb7ea67c0c.tar.gz
Ninja-8f658d63298c5fae29616b8d922d03bb7ea67c0c.tar.bz2
Fix wrapping file paths in Writer.comment
Long file names, especially with hyphens will get incorrectly wrapped by the comment method. Pass has_path=True to prevent this type of wrapping. This is mainly so that longer path names can show up in comments on their on line without breaking them up.
Diffstat (limited to 'misc/ninja_syntax_test.py')
-rwxr-xr-xmisc/ninja_syntax_test.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/misc/ninja_syntax_test.py b/misc/ninja_syntax_test.py
index 36b2e7b..46ce382 100755
--- a/misc/ninja_syntax_test.py
+++ b/misc/ninja_syntax_test.py
@@ -45,6 +45,17 @@ class TestLineWordWrap(unittest.TestCase):
INDENT + 'y']) + '\n',
self.out.getvalue())
+ def test_comment_wrap(self):
+ # We should wrap the comments
+ self.n.comment('Hello there')
+ self.assertEqual('# Hello\n# there\n', self.out.getvalue())
+
+ def test_comment_wrap_filename(self):
+ # Filenames shoud not be wrapped
+ self.n.comment('Hello /usr/local/build-tools/bin', has_path=True)
+ self.assertEqual('# Hello\n# /usr/local/build-tools/bin\n',
+ self.out.getvalue())
+
def test_short_words_indented(self):
# Test that indent is taking into acount when breaking subsequent lines.
# The second line should not be ' to tree', as that's longer than the