OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import StringIO | 5 import StringIO |
6 import unittest | 6 import unittest |
7 | 7 |
8 from webkitpy.common.system.systemhost_mock import MockSystemHost | 8 from webkitpy.common.system.systemhost_mock import MockSystemHost |
9 from webkitpy.formatter.main import main | 9 from webkitpy.formatter.main import main |
10 | 10 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 self.assertMultiLineEqual(host.stdout.getvalue(), ''' | 126 self.assertMultiLineEqual(host.stdout.getvalue(), ''' |
127 def f(): | 127 def f(): |
128 """triple-quoted docstring | 128 """triple-quoted docstring |
129 with multiple lines | 129 with multiple lines |
130 """ | 130 """ |
131 x = """ | 131 x = """ |
132 this is a regular multi-line string, not a docstring | 132 this is a regular multi-line string, not a docstring |
133 """ | 133 """ |
134 return x | 134 return x |
135 ''') | 135 ''') |
| 136 |
| 137 def test_format_docstrings_indentation(self): |
| 138 host = MockSystemHost() |
| 139 host.stdin = StringIO.StringIO(''' |
| 140 def f(): |
| 141 """This is a docstring |
| 142 With extra indentation on this line. |
| 143 |
| 144 """ |
| 145 ''') |
| 146 main(host, ['-']) |
| 147 self.assertMultiLineEqual(host.stdout.getvalue(), ''' |
| 148 def f(): |
| 149 """This is a docstring |
| 150 With extra indentation on this line. |
| 151 """ |
| 152 ''') |
OLD | NEW |