Implicitly support abbreviating commands
[mudpy.git] / mudpy / tests / selftest.py
index 2325f62..520f2fd 100644 (file)
@@ -165,9 +165,10 @@ test_admin_setup = (
 
 test_preferences = (
     (0, "> ", "preferences"),
-    (0, r"prompt \x1b\[32m.*> ", "preferences prompt #"),
-    (0, r"# ", "preferences prompt"),
-    (0, r"#.*# ", "preferences prompt >"),
+    (0, r"prompt \x1b\[32m.*> ", "preferences prompt $(foo)"),
+    (0, r"\$\(foo\) ", "preferences prompt"),
+    (0, r"\$\(foo\).*\$\(foo\) ", "preferences prompt $(time)>"),
+    (0, "[0-9]> ", "preferences prompt >"),
     (2, "> ", "preferences loglevel 0"),
     (2, "> ", "preferences"),
     (2, r"loglevel \x1b\[32m0\x1b\[0m.*> ", "preferences loglevel zero"),
@@ -214,6 +215,12 @@ test_admin_help = (
     (2, "This will save all active accounts", ""),
 )
 
+test_abbrev = (
+    (0, "> ", "help mov"),
+    (0, r"Move in a specific direction\.", "mov north"),
+    (0, r"You exit to the north\.", ""),
+)
+
 test_reload = (
     (2, "> ", "reload"),
     (2, r"Reloading all code modules, configs and data\."
@@ -333,6 +340,7 @@ dialogue = (
     (test_telnet_unknown_option, "log unknown telnet option"),
     (test_admin_restriction, "restricted admin commands"),
     (test_admin_help, "admin help"),
+    (test_abbrev, "command abbreviation"),
     (test_reload, "reload"),
     (test_set_facet, "set facet"),
     (test_set_refused, "refuse altering read-only element"),