From: Jeremy Stanley Date: Sun, 5 May 2019 20:36:17 +0000 (+0000) Subject: Test that macros are escaped in communication X-Git-Tag: 0.0.1~23 X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=commitdiff_plain;h=9ea1249e8e340f62483da7ea68d3c21b5e0018ea;hp=da204426401f781b90121eac018166bcde5ee211 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. --- 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"),