| # Copyright 2019 Google LLC |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| """Tests for util.name_conversion.""" |
| |
| import unittest |
| from compiler.util import name_conversion |
| |
| |
| class NameConversionTest(unittest.TestCase): |
| |
| def test_snake_to_camel(self): |
| self.assertEqual("", name_conversion.snake_to_camel("")) |
| self.assertEqual("Abc", name_conversion.snake_to_camel("abc")) |
| self.assertEqual("AbcDef", name_conversion.snake_to_camel("abc_def")) |
| self.assertEqual("AbcDef89", name_conversion.snake_to_camel("abc_def89")) |
| self.assertEqual("AbcDef89", name_conversion.snake_to_camel("abc_def_89")) |
| self.assertEqual("Abc89Def", name_conversion.snake_to_camel("abc_89_def")) |
| self.assertEqual("Abc89def", name_conversion.snake_to_camel("abc_89def")) |
| |
| |
| if __name__ == "__main__": |
| unittest.main() |