From ef77260efa1122cba42eb97dcadb771ba354276a Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 13 Oct 2022 18:13:08 +0200 Subject: Fix cr, crlf in code (fenced) for mdast --- tests/code_fenced.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests/code_fenced.rs') diff --git a/tests/code_fenced.rs b/tests/code_fenced.rs index c064179..e544ade 100644 --- a/tests/code_fenced.rs +++ b/tests/code_fenced.rs @@ -311,5 +311,33 @@ fn code_fenced() -> Result<(), String> { "should support code (fenced) w/o closing fence in mdast" ); + assert_eq!( + to_mdast("```\rasd\r```", &ParseOptions::default())?, + Node::Root(Root { + children: vec![Node::Code(Code { + lang: None, + meta: None, + value: "asd".into(), + position: Some(Position::new(1, 1, 0, 3, 4, 11)) + })], + position: Some(Position::new(1, 1, 0, 3, 4, 11)) + }), + "should support code (fenced) w/o CR line endings" + ); + + assert_eq!( + to_mdast("```\r\nasd\r\n```", &ParseOptions::default())?, + Node::Root(Root { + children: vec![Node::Code(Code { + lang: None, + meta: None, + value: "asd".into(), + position: Some(Position::new(1, 1, 0, 3, 4, 13)) + })], + position: Some(Position::new(1, 1, 0, 3, 4, 13)) + }), + "should support code (fenced) w/o CR+LF line endings" + ); + Ok(()) } -- cgit