blob: ede309587f33b96322fe8c98ed55bd925fc1167f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import cpp_util
import unittest
class CppUtilTest(unittest.TestCase):
def testClassname(self):
self.assertEquals('Permissions', cpp_util.Classname('permissions'))
self.assertEquals('UpdateAllTheThings',
cpp_util.Classname('updateAllTheThings'))
self.assertEquals('Aa_Bb_Cc', cpp_util.Classname('aa.bb.cc'))
def testNamespaceDeclaration(self):
self.assertEquals('namespace extensions {',
cpp_util.OpenNamespace('extensions').Render())
self.assertEquals('} // namespace extensions',
cpp_util.CloseNamespace('extensions').Render())
self.assertEquals('namespace extensions {\n'
'namespace gen {\n'
'namespace api {',
cpp_util.OpenNamespace('extensions::gen::api').Render())
self.assertEquals('} // namespace api\n'
'} // namespace gen\n'
'} // namespace extensions',
cpp_util.CloseNamespace('extensions::gen::api').Render())
if __name__ == '__main__':
unittest.main()
|