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

Side by Side Diff: build/android/gyp/java_cpp_enum_tests.py

Issue 2505703002: Update error message in java_cpp_enum.py. (Closed)
Patch Set: Fix //net/base/request_priority.h empty prefix Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « build/android/gyp/java_cpp_enum.py ('k') | net/base/request_priority.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 """Tests for enum_preprocess.py. 6 """Tests for enum_preprocess.py.
7 7
8 This test suite containss various tests for the C++ -> Java enum generator. 8 This test suite containss various tests for the C++ -> Java enum generator.
9 """ 9 """
10 10
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 def testParseMalformedMultiLineDirectiveShort(self): 402 def testParseMalformedMultiLineDirectiveShort(self):
403 test_data = """ 403 test_data = """
404 // GENERATED_JAVA_ENUM_PACKAGE: ( 404 // GENERATED_JAVA_ENUM_PACKAGE: (
405 enum Foo { 405 enum Foo {
406 FOO_A, 406 FOO_A,
407 }; 407 };
408 """.split('\n') 408 """.split('\n')
409 with self.assertRaises(Exception): 409 with self.assertRaises(Exception):
410 HeaderParser(test_data).ParseDefinitions() 410 HeaderParser(test_data).ParseDefinitions()
411 411
412 def testParseMalformedMultiLineDirectiveMissingBrackets(self):
413 test_data = """
414 // GENERATED_JAVA_ENUM_PACKAGE:
415 // test.namespace
416 enum Foo {
417 FOO_A,
418 };
419 """.split('\n')
420 with self.assertRaises(Exception):
421 HeaderParser(test_data).ParseDefinitions()
422
412 def testEnumValueAssignmentNoneDefined(self): 423 def testEnumValueAssignmentNoneDefined(self):
413 definition = EnumDefinition(original_enum_name='c', enum_package='p') 424 definition = EnumDefinition(original_enum_name='c', enum_package='p')
414 definition.AppendEntry('A', None) 425 definition.AppendEntry('A', None)
415 definition.AppendEntry('B', None) 426 definition.AppendEntry('B', None)
416 definition.AppendEntry('C', None) 427 definition.AppendEntry('C', None)
417 definition.Finalize() 428 definition.Finalize()
418 self.assertEqual(collections.OrderedDict([('A', 0), 429 self.assertEqual(collections.OrderedDict([('A', 0),
419 ('B', 1), 430 ('B', 1),
420 ('C', 2)]), 431 ('C', 2)]),
421 definition.entries) 432 definition.entries)
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 options, _ = parser.parse_args(argv) 540 options, _ = parser.parse_args(argv)
530 541
531 suite = unittest.TestLoader().loadTestsFromTestCase(TestPreprocess) 542 suite = unittest.TestLoader().loadTestsFromTestCase(TestPreprocess)
532 unittest.TextTestRunner(verbosity=0).run(suite) 543 unittest.TextTestRunner(verbosity=0).run(suite)
533 544
534 if options.stamp: 545 if options.stamp:
535 build_utils.Touch(options.stamp) 546 build_utils.Touch(options.stamp)
536 547
537 if __name__ == '__main__': 548 if __name__ == '__main__':
538 main(sys.argv[1:]) 549 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « build/android/gyp/java_cpp_enum.py ('k') | net/base/request_priority.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698