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_reference.rs | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'tests/character_reference.rs') diff --git a/tests/character_reference.rs b/tests/character_reference.rs index ef2ba0d..c41f47d 100644 --- a/tests/character_reference.rs +++ b/tests/character_reference.rs @@ -1,11 +1,5 @@ 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_reference() { @@ -50,7 +44,13 @@ fn character_reference() { ); assert_eq!( - micromark_with_options("", DANGER), + micromark_with_options( + "", + &Options { + allow_dangerous_html: true, + ..Options::default() + } + ), "", "should not care about character references in html" ); @@ -188,12 +188,18 @@ fn character_reference() { "should not support the other characters inside a hexademical" ); - // To do: turning things off. - // assert_eq!( - // micromark("&", { - // extensions: [{disable: {null: ["characterReferences"]}}] - // }), - // "

&

", - // "should support turning off character references" - // ); + assert_eq!( + micromark_with_options( + "&", + &Options { + constructs: Constructs { + character_reference: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "

&

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