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

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

Issue 2792583002: 📱 Simplify naming of generated java enums IntDefs (Closed)
Patch Set: rebase Created 3 years, 8 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 unified diff | Download patch
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // From 44 // From
45 // path/to/file 45 // path/to/file
46 46
47 package some.package; 47 package some.package;
48 48
49 import android.support.annotation.IntDef; 49 import android.support.annotation.IntDef;
50 50
51 import java.lang.annotation.Retention; 51 import java.lang.annotation.Retention;
52 import java.lang.annotation.RetentionPolicy; 52 import java.lang.annotation.RetentionPolicy;
53 53
54 public class ClassName { 54 @IntDef({
55 @IntDef({ 55 ClassName.E1, ClassName.E2
56 E1, E2 56 })
57 }) 57 @Retention(RetentionPolicy.SOURCE)
58 @Retention(RetentionPolicy.SOURCE) 58 public @interface ClassName {
59 public @interface ClassNameEnum {}
60 /** 59 /**
61 * %s 60 * %s
62 * really really long. 61 * really really long.
63 */ 62 */
64 public static final int E1 = 1; 63 int E1 = 1;
65 /** 64 /**
66 * This is a comment. 65 * This is a comment.
67 */ 66 */
68 public static final int E2 = 2 << 2; 67 int E2 = 2 << 2;
69 } 68 }
70 """ 69 """
71 long_comment = ('This is a multiple line comment that is really long. ' 70 long_comment = ('This is a multiple line comment that is really long. '
72 'This is a multiple line comment that is') 71 'This is a multiple line comment that is')
73 self.assertEqual( 72 self.assertEqual(
74 expected % (date.today().year, GetScriptName(), long_comment), 73 expected % (date.today().year, GetScriptName(), long_comment),
75 output) 74 output)
76 75
77 def testParseSimpleEnum(self): 76 def testParseSimpleEnum(self):
78 test_data = """ 77 test_data = """
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 options, _ = parser.parse_args(argv) 619 options, _ = parser.parse_args(argv)
621 620
622 suite = unittest.TestLoader().loadTestsFromTestCase(TestPreprocess) 621 suite = unittest.TestLoader().loadTestsFromTestCase(TestPreprocess)
623 unittest.TextTestRunner(verbosity=0).run(suite) 622 unittest.TextTestRunner(verbosity=0).run(suite)
624 623
625 if options.stamp: 624 if options.stamp:
626 build_utils.Touch(options.stamp) 625 build_utils.Touch(options.stamp)
627 626
628 if __name__ == '__main__': 627 if __name__ == '__main__':
629 main(sys.argv[1:]) 628 main(sys.argv[1:])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698