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

Unified Diff: build/android/gyp/java_cpp_enum_tests.py

Issue 2210633002: Modify java_cpp_enum.py to preserve comments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: break up long line Created 4 years, 4 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 | « build/android/gyp/java_cpp_enum.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/java_cpp_enum_tests.py
diff --git a/build/android/gyp/java_cpp_enum_tests.py b/build/android/gyp/java_cpp_enum_tests.py
index 3444cfa254affb6369f18017e5b56d379cecc020..643a410d510c50082e54248726313dbfbe935d63 100755
--- a/build/android/gyp/java_cpp_enum_tests.py
+++ b/build/android/gyp/java_cpp_enum_tests.py
@@ -26,7 +26,13 @@ class TestPreprocess(unittest.TestCase):
def testOutput(self):
definition = EnumDefinition(original_enum_name='ClassName',
enum_package='some.package',
- entries=[('E1', 1), ('E2', '2 << 2')])
+ entries=[('E1', 1), ('E2', '2 << 2')],
+ comments=[('E2', 'This is a comment.'),
+ ('E1', 'This is a multiple line '
+ 'comment that is really long. '
+ 'This is a multiple line '
+ 'comment that is really '
+ 'really long.')])
output = GenerateOutput('path/to/file', definition)
expected = """
// Copyright %d The Chromium Authors. All rights reserved.
@@ -51,11 +57,22 @@ public class ClassName {
})
@Retention(RetentionPolicy.SOURCE)
public @interface ClassNameEnum {}
+ /**
+ * %s
+ * really really long.
+ */
public static final int E1 = 1;
+ /**
+ * This is a comment.
+ */
public static final int E2 = 2 << 2;
}
"""
- self.assertEqual(expected % (date.today().year, GetScriptName()), output)
+ long_comment = ('This is a multiple line comment that is really long. '
+ 'This is a multiple line comment that is')
+ self.assertEqual(
+ expected % (date.today().year, GetScriptName(), long_comment),
+ output)
def testParseSimpleEnum(self):
test_data = """
@@ -134,6 +151,8 @@ public class ClassName {
// GENERATED_JAVA_PREFIX_TO_STRIP: P_
enum EnumTwo {
P_A,
+ // This comment spans
+ // two lines.
P_B
};
""".split('\n')
@@ -145,10 +164,13 @@ public class ClassName {
self.assertEqual(collections.OrderedDict([('A', '1'),
('B', 'A')]),
definition.entries)
-
+ self.assertEqual(collections.OrderedDict([('ENUM_ONE_B', 'Comment there')]),
+ definition.comments)
definition = definitions[1]
self.assertEqual('EnumTwo', definition.class_name)
self.assertEqual('other.package', definition.enum_package)
+ self.assertEqual(collections.OrderedDict(
+ [('P_B', 'This comment spans two lines.')]), definition.comments)
self.assertEqual(collections.OrderedDict([('A', 0),
('B', 1)]),
definition.entries)
« no previous file with comments | « build/android/gyp/java_cpp_enum.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698