aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-13 18:13:08 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-13 18:13:08 +0200
commitef77260efa1122cba42eb97dcadb771ba354276a (patch)
tree1a4cb084f3ffc710304ab3768bcd3fa988669302 /tests
parente0ca78397ea34cde06ab8257a8481afc812d344f (diff)
downloadmarkdown-rs-ef77260efa1122cba42eb97dcadb771ba354276a.tar.gz
markdown-rs-ef77260efa1122cba42eb97dcadb771ba354276a.tar.bz2
markdown-rs-ef77260efa1122cba42eb97dcadb771ba354276a.zip
Fix cr, crlf in code (fenced) for mdast
Diffstat (limited to 'tests')
-rw-r--r--tests/code_fenced.rs28
1 files changed, 28 insertions, 0 deletions
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(())
}