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

Unified Diff: build/android/pylib/utils/proguard_test.py

Issue 1353673004: Add some unit tests for pylib.utils.proguard (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restored empty line Created 5 years, 3 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
Index: build/android/pylib/utils/proguard_test.py
diff --git a/build/android/pylib/utils/proguard_test.py b/build/android/pylib/utils/proguard_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..a79906cac0cd71182d278b56bc265316db6dc294
--- /dev/null
+++ b/build/android/pylib/utils/proguard_test.py
@@ -0,0 +1,91 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import unittest
+
+from pylib.utils import proguard
+
+class TestParse(unittest.TestCase):
+
+ def test_all(self):
+ test_data = [
+ # Pairs of input (array of strings) and reference output (dict)
+ ['- Program class: org/example/Test',
jbudorick 2015/09/17 17:10:02 Split these into separate test cases.
mnaganov (inactive) 2015/09/17 17:19:43 Done.
+ ' Superclass: java/lang/Object'],
+ {
+ 'classes': [
+ {
+ 'class': 'org.example.Test',
+ 'superclass': 'java.lang.Object',
+ 'annotations': {},
+ 'methods': []
+ }
+ ]
+ },
+ ['- Program class: org/example/Test',
+ 'Methods (count = 1):',
+ '- Method: <init>()V'],
+ {
+ 'classes': [
+ {
+ 'class': 'org.example.Test',
+ 'superclass': '',
+ 'annotations': {},
+ 'methods': [
+ {
+ 'method': '<init>',
+ 'annotations': {}
+ }
+ ]
+ }
+ ]
+ },
+ ['- Program class: org/example/Test',
+ ' - Annotation [Lorg/example/Annotation;]:',
+ ' - Annotation [Lorg/example/AnnotationWithValue;]:',
+ ' - Constant element value [attr \'13\']',
+ ' - Utf8 [val]'],
+ {
+ 'classes': [
+ {
+ 'class': 'org.example.Test',
+ 'superclass': '',
+ 'annotations': {
+ 'Annotation': None,
+ 'AnnotationWithValue': 'val'
+ },
+ 'methods': []
+ }
+ ]
+ },
+ ['- Program class: org/example/Test',
+ 'Methods (count = 1):',
+ '- Method: Test()V',
+ ' - Annotation [Lorg/example/Annotation;]:',
+ ' - Annotation [Lorg/example/AnnotationWithValue;]:',
+ ' - Constant element value [attr \'13\']',
+ ' - Utf8 [val]'],
+ {
+ 'classes': [
+ {
+ 'class': 'org.example.Test',
+ 'superclass': '',
+ 'annotations': {},
+ 'methods': [
+ {
+ 'method': 'Test',
+ 'annotations': {
+ 'Annotation': None,
+ 'AnnotationWithValue': 'val'
+ },
+ }
+ ]
+ }
+ ]
+ },
+ ]
+ for i in range(0, len(test_data), 2):
+ output = proguard.Parse(test_data[i])
+ ref_output = test_data[i + 1]
+ self.assertEquals(ref_output, output)
« build/android/pylib/constants/__init__.py ('K') | « build/android/pylib/utils/proguard.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698