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/code_text.rs | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'tests/code_text.rs') diff --git a/tests/code_text.rs b/tests/code_text.rs index 054d8e2..834b831 100644 --- a/tests/code_text.rs +++ b/tests/code_text.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: false, - default_line_ending: None, -}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn code_text() { + let danger = Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + assert_eq!( micromark("`foo`"), "

foo

", @@ -106,7 +106,7 @@ fn code_text() { ); assert_eq!( - micromark_with_options("`", DANGER), + micromark_with_options("`", &danger), "

`

", "should have same precedence as HTML (2)" ); @@ -154,10 +154,18 @@ fn code_text() { "should support an escaped initial grave accent" ); - // To do: turning things off. - // assert_eq!( - // micromark("`a`", {extensions: [{disable: {null: ["codeText"]}}]}), - // "

`a`

", - // "should support turning off code (text)" - // ); + assert_eq!( + micromark_with_options( + "`a`", + &Options { + constructs: Constructs { + code_text: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "

`a`

", + "should support turning off code (text)" + ); } -- cgit