Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(913)

Unified Diff: tools/nixysa/nixysa/naming_test.py

Issue 2043006: WTF NPAPI extension. Early draft. Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/nixysa/nixysa/naming.py ('k') | tools/nixysa/nixysa/npapi_generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/nixysa/nixysa/naming_test.py
===================================================================
--- tools/nixysa/nixysa/naming_test.py (revision 0)
+++ tools/nixysa/nixysa/naming_test.py (revision 0)
@@ -0,0 +1,75 @@
+#!/usr/bin/python2.4
+#
+# Copyright 2008 Google Inc.
+#
+# 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
+#
+# http://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.
+
+"""Test for naming."""
+
+import unittest
+import naming
+
+
+class NamingUnitTest(unittest.TestCase):
+ _test_vectors = [(['foo'],
+ {naming.Upper: 'FOO',
+ naming.Lower: 'foo',
+ naming.LowerTrailing: 'foo_',
+ naming.Java: 'foo',
+ naming.Capitalized: 'Foo'}),
+ (['foo', 'bar'],
+ {naming.Upper: 'FOO_BAR',
+ naming.Lower: 'foo_bar',
+ naming.LowerTrailing: 'foo_bar_',
+ naming.Java: 'fooBar',
+ naming.Capitalized: 'FooBar'}),
+ (['foo', 'bar', 'baz'],
+ {naming.Upper: 'FOO_BAR_BAZ',
+ naming.Lower: 'foo_bar_baz',
+ naming.LowerTrailing: 'foo_bar_baz_',
+ naming.Java: 'fooBarBaz',
+ naming.Capitalized: 'FooBarBaz'}),
+ (['rotation', 'x', 'y', 'z'],
+ {naming.Upper: 'ROTATION_X_Y_Z',
+ naming.Lower: 'rotation_x_y_z',
+ naming.LowerTrailing: 'rotation_x_y_z_',
+ naming.Java: 'rotationXYZ',
+ naming.Capitalized: 'RotationXYZ'}),
+ (['vector', '3', 'array'],
+ {naming.Upper: 'VECTOR_3_ARRAY',
+ naming.Lower: 'vector_3_array',
+ naming.LowerTrailing: 'vector_3_array_',
+ naming.Java: 'vector3Array',
+ naming.Capitalized: 'Vector3Array'})]
+
+ def testFunctions(self):
+ for words, results in self._test_vectors:
+ for func in results:
+ self.assertEquals(func(words), results[func])
+
+ def testSplitWords(self):
+ for words, results in self._test_vectors:
+ for func in results:
+ self.assertEquals(naming.SplitWords(results[func]), words)
+
+ def testNormalize(self):
+ for unused_words, results in self._test_vectors:
+ for func_source in results:
+ source = results[func_source]
+ for func_dest in results:
+ dest = results[func_dest]
+ self.assertEquals(naming.Normalize(source, func_dest), dest)
+
+
+if __name__ == '__main__':
+ unittest.main()
Property changes on: tools/nixysa/nixysa/naming_test.py
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « tools/nixysa/nixysa/naming.py ('k') | tools/nixysa/nixysa/npapi_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698