From 5403261e8213f68633a09fc3e9bc2e6e2cd777b2 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 18 Jul 2022 16:31:14 +0200 Subject: Add support for turning off constructs --- tests/list.rs | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'tests/list.rs') diff --git a/tests/list.rs b/tests/list.rs index 2ef349b..b70b489 100644 --- a/tests/list.rs +++ b/tests/list.rs @@ -1,14 +1,13 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; - -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: false, - default_line_ending: None, -}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn list() { + let danger = Options { + allow_dangerous_html: true, + ..Options::default() + }; + assert_eq!( micromark( "A paragraph\nwith two lines.\n\n indented code\n\n> A block quote." @@ -358,13 +357,13 @@ fn list() { ); assert_eq!( - micromark_with_options("- foo\n- bar\n\n\n\n- baz\n- bim", DANGER), + micromark_with_options("- foo\n- bar\n\n\n\n- baz\n- bim", &danger), "\n\n", "should support HTML comments between lists" ); assert_eq!( - micromark_with_options("- foo\n\n notcode\n\n- foo\n\n\n\n code", DANGER), + micromark_with_options("- foo\n\n notcode\n\n- foo\n\n\n\n code", &danger), "\n\n
code\n
", "should support HTML comments between lists and indented code" ); @@ -553,15 +552,23 @@ fn list() { ); assert_eq!( - micromark_with_options("* a\n\n\n\n* b", DANGER), + micromark_with_options("* a\n\n\n\n* b", &danger), "\n\n", "should support the common list breaking comment method" ); - // To do: turning things off. - // assert_eq!( - // micromark("- one\n\n two", {extensions: [{disable: {null: ["list"]}}]}), - // "

- one

\n

two

", - // "should support turning off lists" - // ); + assert_eq!( + micromark_with_options( + "- one\n\n two", + &Options { + constructs: Constructs { + list: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "

- one

\n

two

", + "should support turning off lists" + ); } -- cgit