extern crate micromark; use micromark::{micromark, micromark_with_options, LineEnding, Options}; use pretty_assertions::assert_eq; #[test] fn default_line_ending() { assert_eq!( micromark("> a"), "
\n", "should use `\\n` default" ); assert_eq!( micromark("> a\n"), "a
\n
\n\n", "should infer the first line ending (1)" ); assert_eq!( micromark("> a\r"), "a
\n
\r\r", "should infer the first line ending (2)" ); assert_eq!( micromark("> a\r\n"), "a
\r
\r\n\r\n", "should infer the first line ending (3)" ); assert_eq!( micromark_with_options( "> a", &Options { default_line_ending: LineEnding::CarriageReturn, ..Options::default() } ), "a
\r\n
\r", "should support the given line ending" ); assert_eq!( micromark_with_options( "> a\n", &Options { default_line_ending: LineEnding::CarriageReturn, ..Options::default() } ), // To do: is this a bug in `micromark.js` that it uses `\r` for earlier line endings? // "a
\r
\r\n", "a
\r
\n\n", "should support the given line ending, even if line endings exist" ); }a
\n