summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSavagePeanut <sourcehut@lazytapir.com>2024-07-29 13:40:13 -0500
committerSavagePeanut <sourcehut@lazytapir.com>2024-07-29 13:40:13 -0500
commit57ded2c0151bdf9c71da2073d83ac3021d56f6c8 (patch)
tree730210d1268b5022ed8c41f851947c656a95cf54
parente65a593a121935a245ef02b24d2b9464665c05f8 (diff)
add tests for escapting <element/>s in matrix
-rw-r--r--tests/test_matrix.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_matrix.py b/tests/test_matrix.py
index 01723a9..e1782d1 100644
--- a/tests/test_matrix.py
+++ b/tests/test_matrix.py
@@ -301,3 +301,23 @@ def test_weird_utf8():
test = "~\u200b~"
formatted_body = "<strike>\u200b</strike>"
assert(format_for_matrix(test) == formatted_body)
+
+ test = "<element>"
+ formatted_body = "&lt;element&gt;"
+ assert(format_for_matrix(test) == formatted_body)
+
+ test = "< element >"
+ formatted_body = "&lt; element &gt;"
+ assert(format_for_matrix(test) == formatted_body)
+
+ test = "< element>"
+ formatted_body = "&lt; element&gt;"
+ assert(format_for_matrix(test) == formatted_body)
+
+ test = "<element >"
+ formatted_body = "&lt;element &gt;"
+ assert(format_for_matrix(test) == formatted_body)
+
+ test = "<element> malicious script </element>"
+ formatted_body = "&lt;element&gt; malicious script &lt;/element&gt;"
+ assert(format_for_matrix(test) == formatted_body)