mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-26 05:37:20 -05:00
feat: suggest systems by short name
--system gba, psx or ps1 was refused with no suggestion on RetroArch. Short names now suggest the ids they stand for, never taken in their place, and two aliases of one system name it once. --platform muos and the other systems --list-platforms names stand for the file list they get, and the run says which.
This commit is contained in:
1 parent
41839b7784
commit
e041fac351
6 files changed
+104
-10
No files matched your search
@@ -13,6 +13,7 @@ import functools
|
||||
import hashlib
|
||||
import http.server
|
||||
import importlib.util
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import random
|
||||
@@ -311,6 +312,24 @@ class CommandLineChoices(unittest.TestCase):
|
||||
self.assertIn("sega-saturn", str(ctx.exception))
|
||||
self.assertIn("nintendo-gba", str(ctx.exception))
|
||||
|
||||
def test_a_short_name_is_suggested_never_taken(self):
|
||||
"""`--system gba`, `psx` and `ps1` were refused on RetroArch with no
|
||||
suggestion, though nintendo-gba holds the very letters."""
|
||||
known = [f"system-{i}" for i in range(40)] + [
|
||||
"nintendo-gb", "nintendo-gba", "nintendo-gbc", "sony-playstation",
|
||||
"sony-playstation-2", "sega-mega-drive"]
|
||||
for typed, meant in (("gba", "nintendo-gba"), ("psx", "sony-playstation"),
|
||||
("ps1", "sony-playstation"), ("PS2", "sony-playstation-2"),
|
||||
("genesis", "sega-mega-drive"), ("gb", "nintendo-gb")):
|
||||
with self.subTest(typed=typed), self.assertRaises(ValueError) as ctx:
|
||||
install.resolve_choices([typed], known, "system")
|
||||
self.assertIn(f"Did you mean: {meant}", str(ctx.exception))
|
||||
|
||||
def test_a_short_name_for_a_system_the_list_lacks_is_not_suggested(self):
|
||||
with self.assertRaises(ValueError) as ctx:
|
||||
install.resolve_choices(["psx"], [f"system-{i}" for i in range(40)], "system")
|
||||
self.assertNotIn("sony-playstation", str(ctx.exception))
|
||||
|
||||
def test_an_empty_list_is_refused(self):
|
||||
with self.assertRaises(ValueError):
|
||||
install.resolve_regions([" , "])
|
||||
|
||||
Reference in new issue
Block a user