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) |