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/link_reference.rs | 56 +++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 20 deletions(-) (limited to 'tests/link_reference.rs') diff --git a/tests/link_reference.rs b/tests/link_reference.rs index 30fb2b5..17c8cde 100644 --- a/tests/link_reference.rs +++ b/tests/link_reference.rs @@ -1,14 +1,14 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; - -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: true, - default_line_ending: None, -}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn link_reference() { + let danger = Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + assert_eq!( micromark("[bar]: /url \"title\"\n\n[foo][bar]"), "

foo

", @@ -64,7 +64,7 @@ fn link_reference() { ); assert_eq!( - micromark_with_options("[ref]: /uri\n\n[foo ", DANGER), + micromark_with_options("[ref]: /uri\n\n[foo ", &danger), "

[foo

", "should prefer HTML over link references" ); @@ -383,17 +383,33 @@ fn link_reference() { "should not fail on a missing colon in a definition" ); - // To do: turning things off. - // assert_eq!( - // micromark("[x]()", {extensions: [{disable: {null: ["labelStartLink"]}}]}), - // "

[x]()

", - // "should support turning off label start (link)" - // ); + assert_eq!( + micromark_with_options( + "[x]()", + &Options { + constructs: Constructs { + label_start_link: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "

[x]()

", + "should support turning off label start (link)" + ); - // To do: turning things off. - // assert_eq!( - // micromark("[x]()", {extensions: [{disable: {null: ["labelEnd"]}}]}), - // "

[x]()

", - // "should support turning off label end" - // ); + assert_eq!( + micromark_with_options( + "[x]()", + &Options { + constructs: Constructs { + label_end: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "

[x]()

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