From 0f370ea91d78c7a0394417edbd9b0ea80ffed1c9 Mon Sep 17 00:00:00 2001 From: SavagePeanut Date: Tue, 15 Aug 2023 00:16:12 -0500 Subject: fix quoted code blocks --- tests/test_style_parser.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'tests/test_style_parser.py') diff --git a/tests/test_style_parser.py b/tests/test_style_parser.py index d873644..673b63c 100644 --- a/tests/test_style_parser.py +++ b/tests/test_style_parser.py @@ -98,14 +98,14 @@ def test_code_blocks(): formatted_body = "
why are you quoting a code block
" assert(format_body(test, MATRIX_FORMATS) == formatted_body) - test = ">```\n>please stop trying to break my parser ;-;\n>```" - formatted_body = "
please stop trying to break my parser ;-;
" - assert(format_body(test, MATRIX_FORMATS) == formatted_body) - test = ">>```\n>>double quote code block\n>single quote not in code block\nnormal text" formatted_body = "
double quote code block
\nsingle quote not in code block
\nnormal text" assert(format_body(test, MATRIX_FORMATS) == formatted_body) + test = ">```\n>please stop trying to break my parser ;-;" + formatted_body = "
please stop trying to break my parser ;-;
" + assert(format_body(test, MATRIX_FORMATS) == formatted_body) + test = ">>```\n>>>>double quote code block\n>single quote not in code block\nnormal text" formatted_body = "
>>double quote code block
\nsingle quote not in code block
\nnormal text" assert(format_body(test, MATRIX_FORMATS) == formatted_body) @@ -203,6 +203,10 @@ def test_no_changes(): assert(format_body(test, MATRIX_FORMATS) == formatted_body) def test_assorted(): + test = "\n" + formatted_body = "\n" + assert(format_body(test, MATRIX_FORMATS) == formatted_body) + test = "at the ||end||" formatted_body = "at the end" assert(format_body(test, MATRIX_FORMATS) == formatted_body) @@ -215,6 +219,22 @@ def test_assorted(): formatted_body = "underline bold strikethrough >not quote spoiler\n
quote
\nnothing\nnothing\n
another quote with ```four```
" assert(format_body(test, MATRIX_FORMATS) == formatted_body) + test = ">```\n>do be do be dooo ba do be do be do ba\n>>>" + formatted_body = "
do be do be dooo ba do be do be do ba\n>>
" + assert(format_body(test, MATRIX_FORMATS) == formatted_body) + + test = "\n\n>```\n>do be do be dooo ba do be do be do ba\na\n\n\naoeu\n" + formatted_body = "\n\n
do be do be dooo ba do be do be do ba
\na\n\n\naoeu\n" + assert(format_body(test, MATRIX_FORMATS) == formatted_body) + + test = ">```\n>do be do be dooo ba do be do be do ba\n>\n>\n>aoeu" + formatted_body = "
do be do be dooo ba do be do be do ba\n\n\naoeu
" + assert(format_body(test, MATRIX_FORMATS) == formatted_body) + + test = ">```\n>code block\n>```invalid\n" + formatted_body = "
code block\n```invalid
\n" + assert(format_body(test, MATRIX_FORMATS) == formatted_body) + def test_weird_utf8(): test = "❤️💓💕💖💗 ||💙💚💛💜🖤|| 💝💞💟❣️" formatted_body = "❤️💓💕💖💗 💙💚💛💜🖤 💝💞💟❣️" -- cgit v1.2.3