diff options
author | Nico Weber <thakis@chromium.org> | 2011-12-22 20:21:12 (GMT) |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2011-12-22 20:21:12 (GMT) |
commit | ebb6c593468267f1c23ffc2a1a56e8f04fb8fca0 (patch) | |
tree | 1c6445c8adf5ef8131c4b2b9900db1006b7caaf3 /misc/ninja_test.py | |
parent | ec65275c2613b01115ab4a5c07408e3e53ce7a6e (diff) | |
download | Ninja-ebb6c593468267f1c23ffc2a1a56e8f04fb8fca0.zip Ninja-ebb6c593468267f1c23ffc2a1a56e8f04fb8fca0.tar.gz Ninja-ebb6c593468267f1c23ffc2a1a56e8f04fb8fca0.tar.bz2 |
Let ninja_syntax handle escaped spaces correctly.
Revert the main loop changes made in 2e7ab7514207ea7faad40faedf3fc9d72b3adf7a,
and add just a few lines to the original main loop to make '$ ' escaping work.
Add several new tests, and make the existing tests pass again.
Diffstat (limited to 'misc/ninja_test.py')
-rwxr-xr-x | misc/ninja_test.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/misc/ninja_test.py b/misc/ninja_test.py index 481912e..65dbec6 100755 --- a/misc/ninja_test.py +++ b/misc/ninja_test.py @@ -66,5 +66,50 @@ class TestLineWordWrap(unittest.TestCase): ''', self.out.getvalue()) + def test_leading_space(self): + self.n = ninja_syntax.Writer(self.out, width=14) # force wrapping + self.n.variable('foo', ['', '-bar', '-somethinglong'], 0) + self.assertEqual('''\ +foo = -bar $ + -somethinglong +''', + self.out.getvalue()) + + def test_embedded_dollar_dollar(self): + self.n = ninja_syntax.Writer(self.out, width=15) # force wrapping + self.n.variable('foo', ['a$$b', '-somethinglong'], 0) + self.assertEqual('''\ +foo = a$$b $ + -somethinglong +''', + self.out.getvalue()) + + def test_two_embedded_dollar_dollars(self): + self.n = ninja_syntax.Writer(self.out, width=17) # force wrapping + self.n.variable('foo', ['a$$b', '-somethinglong'], 0) + self.assertEqual('''\ +foo = a$$b $ + -somethinglong +''', + self.out.getvalue()) + + def test_leading_dollar_dollar(self): + self.n = ninja_syntax.Writer(self.out, width=14) # force wrapping + self.n.variable('foo', ['$$b', '-somethinglong'], 0) + self.assertEqual('''\ +foo = $$b $ + -somethinglong +''', + self.out.getvalue()) + + def test_trailing_dollar_dollar(self): + self.n = ninja_syntax.Writer(self.out, width=14) # force wrapping + self.n.variable('foo', ['a$$', '-somethinglong'], 0) + self.assertEqual('''\ +foo = a$$ $ + -somethinglong +''', + self.out.getvalue()) + if __name__ == '__main__': unittest.main() |