summaryrefslogtreecommitdiffstats
path: root/misc/ninja_test.py
diff options
context:
space:
mode:
authorJeremy Apthorp <jeremya@chromium.org>2011-11-28 03:27:02 (GMT)
committerJeremy Apthorp <jeremya@chromium.org>2011-11-29 05:36:33 (GMT)
commit9be1597a218e61fd6f7f5b3c3a52ebd2e51cac6b (patch)
tree912e6e5a8f1c83f2d7012ce48d1c0c0f63b42fc6 /misc/ninja_test.py
parent4d142a410891144f11259b7e8432c0a81c88215c (diff)
downloadNinja-9be1597a218e61fd6f7f5b3c3a52ebd2e51cac6b.zip
Ninja-9be1597a218e61fd6f7f5b3c3a52ebd2e51cac6b.tar.gz
Ninja-9be1597a218e61fd6f7f5b3c3a52ebd2e51cac6b.tar.bz2
Update ninja_syntax.py and tests to reflect '$ ' syntax.
Diffstat (limited to 'misc/ninja_test.py')
-rwxr-xr-xmisc/ninja_test.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/misc/ninja_test.py b/misc/ninja_test.py
index 762fe16..481912e 100755
--- a/misc/ninja_test.py
+++ b/misc/ninja_test.py
@@ -20,6 +20,7 @@ from StringIO import StringIO
import ninja_syntax
LONGWORD = 'a' * 10
+LONGWORDWITHSPACES = 'a'*5 + '$ ' + 'a'*5
INDENT = ' '
class TestLineWordWrap(unittest.TestCase):
@@ -48,5 +49,22 @@ class TestLineWordWrap(unittest.TestCase):
' ' + INDENT + 'y']) + '\n',
self.out.getvalue())
+ def test_escaped_spaces(self):
+ self.n._line(' '.join(['x', LONGWORDWITHSPACES, 'y']))
+ self.assertEqual(' $\n'.join(['x',
+ INDENT + LONGWORDWITHSPACES,
+ INDENT + 'y']) + '\n',
+ self.out.getvalue())
+
+ def test_fit_many_words(self):
+ self.n = ninja_syntax.Writer(self.out, width=78)
+ self.n._line('command = cd ../../chrome; python ../tools/grit/grit/format/repack.py ../out/Debug/obj/chrome/chrome_dll.gen/repack/theme_resources_large.pak ../out/Debug/gen/chrome/theme_resources_large.pak', 1)
+ self.assertEqual('''\
+ command = cd ../../chrome; python ../tools/grit/grit/format/repack.py $
+ ../out/Debug/obj/chrome/chrome_dll.gen/repack/theme_resources_large.pak $
+ ../out/Debug/gen/chrome/theme_resources_large.pak
+''',
+ self.out.getvalue())
+
if __name__ == '__main__':
unittest.main()