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/character_escape.rs | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'tests/character_escape.rs') diff --git a/tests/character_escape.rs b/tests/character_escape.rs index d27f20a..8cd170d 100644 --- a/tests/character_escape.rs +++ b/tests/character_escape.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 character_escape() { + let danger = Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + assert_eq!( micromark( "\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~" @@ -56,7 +56,7 @@ fn character_escape() { ); assert_eq!( - micromark_with_options("", DANGER), + micromark_with_options("", &danger), "", "should not escape in flow html" ); @@ -79,10 +79,18 @@ fn character_escape() { "should escape in fenced code info" ); - // To do: turning things off - // assert_eq!( - // micromark("\\> a", {extensions: [{disable: {null: ["characterEscape"]}}]}), - // "

\\> a

", - // "should support turning off character escapes" - // ); + assert_eq!( + micromark_with_options( + "\\> a", + &Options { + constructs: Constructs { + character_escape: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "

\\> a

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