From dc689f976f2b9c674d0062e8ae4b95a24347d4ca Mon Sep 17 00:00:00 2001 From: Noah Hellman Date: Fri, 2 Dec 2022 20:07:37 +0100 Subject: [PATCH] fixup! test_parse, test_block --- src/block.rs | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/src/block.rs b/src/block.rs index 01e32da..05b79f0 100644 --- a/src/block.rs +++ b/src/block.rs @@ -403,13 +403,31 @@ mod test { ); } + #[test] + fn parse_blockquote_empty() { + test_parse!( + "> \n", + (Enter(Container(Blockquote)), ">"), + (Element(Blankline), "\n"), + (Exit(Container(Blockquote)), ">"), + ); + test_parse!( + ">", + (Enter(Container(Blockquote)), ">"), + (Element(Blankline), ""), + (Exit(Container(Blockquote)), ">"), + ); + } + #[test] fn parse_code_block() { test_parse!( concat!( "```\n", "l0\n", - "```", // + "```\n", + "\n", + "para\n", // ), (Enter(Leaf(CodeBlock { fence_length: 3 })), "```"), (Element(Inline), ""), @@ -479,7 +497,7 @@ mod test { } #[test] - fn block_container() { + fn block_blockquote() { test_block!( concat!( "> a\n", // @@ -493,4 +511,33 @@ mod test { 5, ); } + + #[test] + fn block_code_block_seq() { + test_block!( + concat!( + "```` lang\n", + "l0\n", + "```\n", + " l1\n", + "````", // + ), + Block::Leaf(CodeBlock { fence_length: 4 }), + "````", + 5, + ); + test_block!( + concat!( + "```\n", // + "a\n", // + "```\n", // + "```\n", // + "bbb\n", // + "```\n", // + ), + Block::Leaf(CodeBlock { fence_length: 3 }), + "```", + 3, + ); + } }