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/image.rs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'tests/image.rs') diff --git a/tests/image.rs b/tests/image.rs index 32d4171..460d8bb 100644 --- a/tests/image.rs +++ b/tests/image.rs @@ -1,5 +1,5 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn image() { @@ -191,12 +191,20 @@ fn image() { "should ignore an empty title" ); - // To do: turning things off. - // assert_eq!( - // micromark("![x]()", {extensions: [{disable: {null: ["labelStartImage"]}}]}), - // "

!x

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

!x

", + "should support turning off label start (image)" + ); assert_eq!( micromark("![](javascript:alert(1))"), @@ -209,8 +217,7 @@ fn image() { "![](javascript:alert(1))", &Options { allow_dangerous_protocol: true, - allow_dangerous_html: false, - default_line_ending: None + ..Options::default() } ), "

\"\"

", -- cgit