From 9ea1249e8e340f62483da7ea68d3c21b5e0018ea Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Sun, 5 May 2019 20:36:17 +0000 Subject: [PATCH] Test that macros are escaped in communication We explicitly escape replacement macros in user input for communication commands (say, ask, et cetera). Test to make sure this safety measure does not regress. --- mudpy/tests/selftest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mudpy/tests/selftest.py b/mudpy/tests/selftest.py index 202778a..2325f62 100644 --- a/mudpy/tests/selftest.py +++ b/mudpy/tests/selftest.py @@ -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"), -- 2.11.0