Skip to content

Commit 4423b11

Browse files
committed
Move testcases of test_r2apkinfo.py into test_apkinfo.py
1 parent 4a550d5 commit 4423b11

File tree

2 files changed

+42
-35
lines changed

2 files changed

+42
-35
lines changed

tests/core/test_apkinfo.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ def apkinfo_without_R2Imp(request, apk_path):
5252
yield apkinfo
5353

5454

55+
@pytest.fixture(
56+
scope="function",
57+
params=((R2Imp),),
58+
)
59+
def apkinfo_with_R2Imp_only(request, apk_path):
60+
"""For testcases involved with R2 core lib.
61+
"""
62+
Apkinfo, apk_path = request.param, apk_path
63+
apkinfo = Apkinfo(apk_path)
64+
65+
yield apkinfo
66+
67+
5568
@pytest.fixture(scope="function")
5669
def dex_file():
5770
APK_SOURCE = (
@@ -390,3 +403,32 @@ def test_superclass_relationships_with_expected_class(self, apkinfo):
390403
upper_set = apkinfo.superclass_relationships[class_name]
391404

392405
assert expected_upper_class == upper_set
406+
407+
408+
@staticmethod
409+
@pytest.mark.parametrize(
410+
"test_input, expected",
411+
[
412+
(
413+
"Landroid/view/KeyEvent;",
414+
str,
415+
),
416+
(
417+
0x3e8,
418+
float,
419+
),
420+
(
421+
("Ljava/lang/StringBuilder;->append(Ljava/lang/String;)"
422+
"Ljava/lang/StringBuilder;"),
423+
str,
424+
),
425+
(
426+
"str.google.c.a.tc",
427+
str,
428+
),
429+
],
430+
)
431+
def test_parse_parameter(test_input, expected, apkinfo_with_R2Imp_only):
432+
apkinfo = apkinfo_with_R2Imp_only
433+
parsed_param = apkinfo._parse_parameter(test_input)
434+
assert isinstance(parsed_param, expected)

tests/core/test_r2apkinfo.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)