Test that macros are escaped in communication
[mudpy.git] / mudpy / tests / selftest.py
index 202778a..2325f62 100644 (file)
@@ -111,6 +111,11 @@ test_forbid_ansi_input = (
     (1, r'says, "\[35mfoo\[0m\."', ""),
 )
 
+test_escape_macros = (
+    (0, '> ', "say $(red)bar$(nrm)"),
+    (1, r'says, "\$\(red\)bar\$\(nrm\)."', ""),
+)
+
 test_movement = (
     (0, "> ", "move north"),
     (0, r"You exit to the north\.", ""),
@@ -316,6 +321,7 @@ dialogue = (
     (test_chat_mode, "chat mode"),
     (test_wrapping, "wrapping"),
     (test_forbid_ansi_input, "raw escape input is filtered"),
+    (test_escape_macros, "replacement macros are escaped"),
     (test_movement, "movement"),
     (test_actor_disappears, "actor spontaneous disappearance"),
     (test_account1_teardown, "second account teardown"),