fix: count an alias as declared in the gap report

This commit is contained in:
Abdessamad Derraz committed 2026-10-10 11:16:59 +02:00
1 parent b00352754c
commit de795262d7
2 files changed
+23 -2

No files matched your search

+5 -2
View File
@@ -402,8 +402,11 @@ def _cross_reference_profile(
archive = f.get("archive")
# Check platform declaration (by name or archive)
in_platform = fname in platform_names
# Check platform declaration: by name, by an alias the core answers
# to (RetroArch lists amiberry's cd32.rom as kick40060.CD32), or by
# archive.
answers = {fname, *f.get("aliases", [])}
in_platform = bool(answers & platform_names)
if not in_platform and archive:
in_platform = archive in platform_names
+18
View File
@@ -45,5 +45,23 @@ class FlatDeclaredSet(unittest.TestCase):
self.assertLess(flat["bk"]["gaps"], per_system["bk"]["gaps"])
class AnAliasIsADeclaration(unittest.TestCase):
"""RetroArch lists amiberry's cd32.rom as kick40060.CD32, an alias the
profile declares; the gap report still called cd32.rom undeclared."""
def test_a_file_declared_under_its_alias_is_covered(self):
profiles = {"amiberry": {
"emulator": "Amiberry", "type": "libretro", "systems": ["commodore-amiga"],
"files": [{"name": "cd32.rom", "aliases": ["kick40060.CD32"], "size": 524288}],
}}
db = {"files": {}, "indexes": {"by_name": {}, "by_md5": {}, "by_crc32": {},
"by_path_suffix": {}}}
report = cross_reference(
profiles, {}, db, {}, {"by_name": {}},
all_declared={"kick40060.CD32"},
)
self.assertEqual(report["amiberry"]["gap_details"], [])
if __name__ == "__main__":
unittest.main()