OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import cStringIO | 6 import cStringIO |
7 import difflib | 7 import difflib |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 import unittest | 10 import unittest |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 struct Foo { | 102 struct Foo { |
103 std::string name; | 103 std::string name; |
104 int problems[99]; | 104 int problems[99]; |
105 };""" | 105 };""" |
106 self._RunTest(template, expected, { | 106 self._RunTest(template, expected, { |
107 'name': 'Foo', | 107 'name': 'Foo', |
108 'fields': [ | 108 'fields': [ |
109 {'name': 'name', 'type': 'std::string'}, | 109 {'name': 'name', 'type': 'std::string'}, |
110 {'name': 'problems', 'type': 'array', 'basetype': 'int', 'size': 99}]}) | 110 {'name': 'problems', 'type': 'array', 'basetype': 'int', 'size': 99}]}) |
111 | 111 |
| 112 def testModulo(self): |
| 113 self._RunTest('No expression %', 'No expression %', {}) |
| 114 self._RunTest('% before {{3 + 4}}', '% before 7', {}) |
| 115 self._RunTest('{{2**8}} % after', '256 % after', {}) |
| 116 self._RunTest('inside {{8 % 3}}', 'inside 2', {}) |
| 117 self._RunTest('Everywhere % {{8 % 3}} %', 'Everywhere % 2 %', {}) |
| 118 |
112 | 119 |
113 if __name__ == '__main__': | 120 if __name__ == '__main__': |
114 unittest.main() | 121 unittest.main() |
OLD | NEW |