mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-25 13:19:03 -05:00
fix: count core copies under their own category
The second pass, the archive-prefix pass and the agnostic scan built extras without source_name or source_path, so verify found no gap report entry for them and counted game data such as hiscore.dat as core files. Every extra now carries its entry's category and key, and verify reads the category from the extra the builder places.
This commit is contained in:
1 parent
084dff84f4
commit
3b60facd34
3 files changed
+66
-21
No files matched your search
@@ -517,5 +517,41 @@ class TheReleaseNotesReadTheRecord(unittest.TestCase):
|
||||
self.assertIn("scripts/release_notes.py", page)
|
||||
|
||||
|
||||
class CoreCopiesKeepTheirCategory(unittest.TestCase):
|
||||
"""The second pass copies a file the platform declares to the path a core
|
||||
reads it from. Its extra named no gap report entry, so verify looked its
|
||||
category up by an empty key and counted RetroArch's six hiscore.dat
|
||||
copies, game data, under core files."""
|
||||
|
||||
def test_a_copy_counts_as_its_entry_says(self):
|
||||
from packextras import _collect_emulator_extras, hidden_extras
|
||||
|
||||
with tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") as tmp:
|
||||
held = Path(tmp) / "x.dat"
|
||||
held.write_bytes(b"data")
|
||||
sha1 = hashlib.sha1(b"data").hexdigest()
|
||||
config = {"platform": "P", "_key": "p", "cores": ["demo"], "systems": {
|
||||
"s": {"files": [{"name": "x.dat", "destination": "x.dat"}]}}}
|
||||
profiles = {"demo": {
|
||||
"emulator": "Demo", "type": "libretro", "cores": ["demo"],
|
||||
"systems": ["s"],
|
||||
"files": [{"name": "x.dat", "path": "core/x.dat",
|
||||
"category": "game_data"}],
|
||||
}}
|
||||
db = {"files": {sha1: {"path": str(held), "name": "x.dat", "sha1": sha1}},
|
||||
"indexes": {"by_name": {"x.dat": [sha1]}, "by_path_suffix": {}}}
|
||||
(extra,) = _collect_emulator_extras(
|
||||
config, "emulators", db, {"x.dat"}, "", profiles
|
||||
)
|
||||
self.assertEqual(
|
||||
(extra["source_name"], extra["source_path"], extra["category"]),
|
||||
("x.dat", "core/x.dat", "game_data"),
|
||||
)
|
||||
kinds: dict[str, str] = {}
|
||||
hidden_extras(config, "emulators", db, profiles, {"x.dat": str(held)},
|
||||
report=[], placed_kind=kinds)
|
||||
self.assertEqual(kinds, {"core/x.dat": "game_data"})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user