aboutsummaryrefslogtreecommitdiffstats
path: root/tests/character_escape.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-18 16:31:14 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-18 16:31:14 +0200
commit5403261e8213f68633a09fc3e9bc2e6e2cd777b2 (patch)
treebb3a6419ef42f7611c2cb24fe7024228f579331b /tests/character_escape.rs
parent03544cafaa82ba4bd7e0bc3372fc59549a8dc0cc (diff)
downloadmarkdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.tar.gz
markdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.tar.bz2
markdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.zip
Add support for turning off constructs
Diffstat (limited to 'tests/character_escape.rs')
-rw-r--r--tests/character_escape.rs36
1 files changed, 22 insertions, 14 deletions
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("<a href=\"/bar\\/)\">", DANGER),
+ micromark_with_options("<a href=\"/bar\\/)\">", &danger),
"<a href=\"/bar\\/)\">",
"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"]}}]}),
- // "<p>\\&gt; a</p>",
- // "should support turning off character escapes"
- // );
+ assert_eq!(
+ micromark_with_options(
+ "\\> a",
+ &Options {
+ constructs: Constructs {
+ character_escape: false,
+ ..Constructs::default()
+ },
+ ..Options::default()
+ }
+ ),
+ "<p>\\&gt; a</p>",
+ "should support turning off character escapes"
+ );
}