Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import unittest | |
| 6 | |
| 7 from pylib.utils import proguard | |
| 8 | |
| 9 class TestParse(unittest.TestCase): | |
| 10 | |
| 11 def test_all(self): | |
| 12 test_data = [ | |
| 13 # Pairs of input (array of strings) and reference output (dict) | |
| 14 ['- 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.
| |
| 15 ' Superclass: java/lang/Object'], | |
| 16 { | |
| 17 'classes': [ | |
| 18 { | |
| 19 'class': 'org.example.Test', | |
| 20 'superclass': 'java.lang.Object', | |
| 21 'annotations': {}, | |
| 22 'methods': [] | |
| 23 } | |
| 24 ] | |
| 25 }, | |
| 26 ['- Program class: org/example/Test', | |
| 27 'Methods (count = 1):', | |
| 28 '- Method: <init>()V'], | |
| 29 { | |
| 30 'classes': [ | |
| 31 { | |
| 32 'class': 'org.example.Test', | |
| 33 'superclass': '', | |
| 34 'annotations': {}, | |
| 35 'methods': [ | |
| 36 { | |
| 37 'method': '<init>', | |
| 38 'annotations': {} | |
| 39 } | |
| 40 ] | |
| 41 } | |
| 42 ] | |
| 43 }, | |
| 44 ['- Program class: org/example/Test', | |
| 45 ' - Annotation [Lorg/example/Annotation;]:', | |
| 46 ' - Annotation [Lorg/example/AnnotationWithValue;]:', | |
| 47 ' - Constant element value [attr \'13\']', | |
| 48 ' - Utf8 [val]'], | |
| 49 { | |
| 50 'classes': [ | |
| 51 { | |
| 52 'class': 'org.example.Test', | |
| 53 'superclass': '', | |
| 54 'annotations': { | |
| 55 'Annotation': None, | |
| 56 'AnnotationWithValue': 'val' | |
| 57 }, | |
| 58 'methods': [] | |
| 59 } | |
| 60 ] | |
| 61 }, | |
| 62 ['- Program class: org/example/Test', | |
| 63 'Methods (count = 1):', | |
| 64 '- Method: Test()V', | |
| 65 ' - Annotation [Lorg/example/Annotation;]:', | |
| 66 ' - Annotation [Lorg/example/AnnotationWithValue;]:', | |
| 67 ' - Constant element value [attr \'13\']', | |
| 68 ' - Utf8 [val]'], | |
| 69 { | |
| 70 'classes': [ | |
| 71 { | |
| 72 'class': 'org.example.Test', | |
| 73 'superclass': '', | |
| 74 'annotations': {}, | |
| 75 'methods': [ | |
| 76 { | |
| 77 'method': 'Test', | |
| 78 'annotations': { | |
| 79 'Annotation': None, | |
| 80 'AnnotationWithValue': 'val' | |
| 81 }, | |
| 82 } | |
| 83 ] | |
| 84 } | |
| 85 ] | |
| 86 }, | |
| 87 ] | |
| 88 for i in range(0, len(test_data), 2): | |
| 89 output = proguard.Parse(test_data[i]) | |
| 90 ref_output = test_data[i + 1] | |
| 91 self.assertEquals(ref_output, output) | |
| OLD | NEW |