fix: suggest the nearest system or emulator name

This commit is contained in:
Abdessamad Derraz committed 2026-10-17 12:44:22 +02:00
1 parent c1c3808e1e
commit feb3b03a39
4 files changed
+33 -9

No files matched your search

+12
View File
@@ -163,5 +163,17 @@ class ExclusionNotesListedOnAsk(unittest.TestCase):
self.assertRegex(verbose, r"No external files \(\d+\):")
self.assertLess(len(plain.splitlines()), len(verbose.splitlines()))
class ATypoGetsTheNearestNames(unittest.TestCase):
"""The hint listed the first names of the alphabet behind "...":
sony-playstaton was answered with 3do to apple-iie."""
def test_suggestions_follow_the_typed_name(self):
hint = common.suggest_names(["sony-playstaton"],
["3do", "apple-ii", "sony-playstation"], "--list-systems")
self.assertEqual(hint, "Did you mean: sony-playstation? --list-systems lists all 3.")
self.assertEqual(common.suggest_names(["zzz"], ["3do"], "--list-systems"),
"--list-systems lists all 1.")
if __name__ == "__main__":
unittest.main()