| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 from code import Code | 5 from code import Code |
| 6 import unittest | 6 import unittest |
| 7 | 7 |
| 8 class CodeTest(unittest.TestCase): | 8 class CodeTest(unittest.TestCase): |
| 9 def testAppend(self): | 9 def testAppend(self): |
| 10 c = Code() | 10 c = Code() |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 '// word, length', | 141 '// word, length', |
| 142 c.Render()) | 142 c.Render()) |
| 143 long_word = 'x' * 100 | 143 long_word = 'x' * 100 |
| 144 c = Code() | 144 c = Code() |
| 145 c.Comment(long_word) | 145 c.Comment(long_word) |
| 146 self.assertEquals( | 146 self.assertEquals( |
| 147 '// ' + 'x' * 77 + '\n' | 147 '// ' + 'x' * 77 + '\n' |
| 148 '// ' + 'x' * 23, | 148 '// ' + 'x' * 23, |
| 149 c.Render()) | 149 c.Render()) |
| 150 | 150 |
| 151 def testCommentWithSpecialCharacters(self): |
| 152 c = Code() |
| 153 c.Comment('20% of 80%s') |
| 154 c.Substitute({}) |
| 155 self.assertEquals('// 20% of 80%s', c.Render()) |
| 156 d = Code() |
| 157 d.Append('90') |
| 158 d.Concat(c) |
| 159 self.assertEquals('90\n' |
| 160 '// 20% of 80%s', |
| 161 d.Render()) |
| 162 |
| 151 if __name__ == '__main__': | 163 if __name__ == '__main__': |
| 152 unittest.main() | 164 unittest.main() |
| OLD | NEW |