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 cpp_util | 6 import cpp_util |
7 import unittest | 7 import unittest |
8 | 8 |
9 class CppUtilTest(unittest.TestCase): | 9 class CppUtilTest(unittest.TestCase): |
10 def testClassname(self): | 10 def testClassname(self): |
11 self.assertEquals('Permissions', cpp_util.Classname('permissions')) | 11 self.assertEquals('Permissions', cpp_util.Classname('permissions')) |
12 self.assertEquals('UpdateAllTheThings', | 12 self.assertEquals('UpdateAllTheThings', |
13 cpp_util.Classname('updateAllTheThings')) | 13 cpp_util.Classname('updateAllTheThings')) |
14 self.assertEquals('Aa_Bb_Cc', cpp_util.Classname('aa.bb.cc')) | 14 self.assertEquals('Aa_Bb_Cc', cpp_util.Classname('aa.bb.cc')) |
15 | 15 |
| 16 def testNamespaceDeclaration(self): |
| 17 self.assertEquals('namespace extensions {', |
| 18 cpp_util.OpenNamespace('extensions').Render()) |
| 19 self.assertEquals('} // namespace extensions', |
| 20 cpp_util.CloseNamespace('extensions').Render()) |
| 21 self.assertEquals('namespace extensions {\n' |
| 22 'namespace gen {\n' |
| 23 'namespace api {', |
| 24 cpp_util.OpenNamespace('extensions::gen::api').Render()) |
| 25 self.assertEquals('} // namespace api\n' |
| 26 '} // namespace gen\n' |
| 27 '} // namespace extensions', |
| 28 cpp_util.CloseNamespace('extensions::gen::api').Render()) |
| 29 |
16 if __name__ == '__main__': | 30 if __name__ == '__main__': |
17 unittest.main() | 31 unittest.main() |
OLD | NEW |