mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-23 04:09:08 -05:00
fix: patch Batocera's values, not its entries
An entry with one md5 to correct was written again whole: atarist lost its eight blank lines, every '"x"},' became '"x" },', and most of the 819 lines Batocera's export changed were layout. Each item now keeps its own text and only the md5 inside it changes; an addition follows the last item in its indentation and spacing. The patched entry must read as the one that would have been written, or that one is written. Batocera's diff to the original drops to 273 lines, ROCKNIX's to 3.
This commit is contained in:
1 parent
2faf971aa3
commit
aaffcdcb63
2 files changed
+139
-1
No files matched your search
@@ -1569,6 +1569,55 @@ class RetrodeckExport(unittest.TestCase):
|
||||
self.assertEqual(set(written), {self.A, self.B, self.C})
|
||||
|
||||
|
||||
class BatoceraPatchesValuesNotEntries(unittest.TestCase):
|
||||
"""An entry with one md5 to correct was written again whole: atarist's
|
||||
eight blank lines went, each '"x"},' became '"x" },', and 941 lines of
|
||||
Batocera's diff were layout."""
|
||||
|
||||
ORIGINAL = (
|
||||
"#!/usr/bin/env python\n"
|
||||
"systems = {\n"
|
||||
' "atarist": { "name": "Atari ST", "biosFiles": [\n'
|
||||
' # ST\n'
|
||||
' { "md5": "' + "1" * 32 + '", "file": "bios/tos102.img"},\n'
|
||||
"\n"
|
||||
' { "md5": "' + "2" * 32 + '", "file": "bios/tos104.img"}\n'
|
||||
" ] },\n"
|
||||
"}\n"
|
||||
"def checkBios(systems, prefix, filterROMs):\n"
|
||||
" return {}\n"
|
||||
)
|
||||
|
||||
def render(self, truth_files):
|
||||
scraped = {"cores": ["hatari"], "systems": {"atari-st": {"native_id": "atarist", "files": [
|
||||
{"name": "tos102.img", "destination": "tos102.img", "native_system": "atarist",
|
||||
"native_name": "Atari ST", "native_path": "bios/tos102.img", "md5": "1" * 32},
|
||||
{"name": "tos104.img", "destination": "tos104.img", "native_system": "atarist",
|
||||
"native_name": "Atari ST", "native_path": "bios/tos104.img", "md5": "2" * 32},
|
||||
]}}}
|
||||
systems, report = build_native_model({"systems": {"atari-st": {"files": truth_files}}},
|
||||
scraped)
|
||||
exporter = discover_exporters()["batocera"]()
|
||||
return exporter.render(systems, report, {"batocera-systems": self.ORIGINAL}, scraped)[
|
||||
"batocera-systems"]
|
||||
|
||||
def test_a_corrected_md5_changes_that_value_only(self):
|
||||
produced = self.render([{"name": "tos104.img", "path": "tos104.img",
|
||||
"md5": "3" * 32, "_cores": ["hatari"]}])
|
||||
expected = self.ORIGINAL.replace("2" * 32, "3" * 32)
|
||||
self.assertEqual(produced, expected)
|
||||
|
||||
def test_an_addition_follows_the_last_item_in_its_form(self):
|
||||
produced = self.render([{"name": "tos206.img", "path": "tos206.img",
|
||||
"md5": "4" * 32, "_cores": ["hatari"]}])
|
||||
self.assertIn('"file": "bios/tos104.img"},\n'
|
||||
' { "md5": "' + "4" * 32 + '", "file": "bios/tos206.img",'
|
||||
' "emulator": "libretro", "core": "hatari"}\n'
|
||||
" ] },", produced)
|
||||
self.assertIn("# ST\n", produced)
|
||||
self.assertIn('"file": "bios/tos102.img"},\n\n', produced)
|
||||
|
||||
|
||||
class BatoceraExport(unittest.TestCase):
|
||||
def _render(self, originals):
|
||||
systems, report = model()
|
||||
|
||||
Reference in new issue
Block a user