Add test for script & output rendered

This commit is contained in:
Aayush Goel
2023-08-07 22:43:25 +05:30
parent b3a9763a32
commit 232c9ce35c
2 changed files with 5 additions and 2 deletions

View File

@@ -93,8 +93,10 @@ def highlight_unused_features(feature_map: Dict[Feature, int], rules_feature_set
for feature, count in feature_map.items():
if feature in rules_feature_set:
continue
unused_features.append((get_colored(str(count)), get_colored(str(feature))))
unused_features = sorted(unused_features, key=lambda x: x[0])
unused_features.append((count, get_colored(str(feature))))
unused_features = [
(get_colored(str(count)), feature) for count, feature in sorted(unused_features, key=lambda x: x[0])
]
print("\n")
print(tabulate.tabulate(unused_features, headers=["Count", "Feature"], tablefmt="plain"))
print("\n")

View File

@@ -45,6 +45,7 @@ def get_rule_path():
pytest.param("show-capabilities-by-function.py", [get_file_path()]),
pytest.param("show-features.py", [get_file_path()]),
pytest.param("show-features.py", ["-F", "0x407970", get_file_path()]),
pytest.param("show-unused-features.py", [get_file_path()]),
pytest.param("capa_as_library.py", [get_file_path()]),
],
)