aboutsummaryrefslogtreecommitdiffstats
path: root/tests/character_reference.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_reference.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 '')
-rw-r--r--tests/character_reference.rs38
1 files changed, 22 insertions, 16 deletions
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("<a href=\"&ouml;&ouml;.html\">", DANGER),
+ micromark_with_options(
+ "<a href=\"&ouml;&ouml;.html\">",
+ &Options {
+ allow_dangerous_html: true,
+ ..Options::default()
+ }
+ ),
"<a href=\"&ouml;&ouml;.html\">",
"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("&amp;", {
- // extensions: [{disable: {null: ["characterReferences"]}}]
- // }),
- // "<p>&amp;</p>",
- // "should support turning off character references"
- // );
+ assert_eq!(
+ micromark_with_options(
+ "&amp;",
+ &Options {
+ constructs: Constructs {
+ character_reference: false,
+ ..Constructs::default()
+ },
+ ..Options::default()
+ }
+ ),
+ "<p>&amp;amp;</p>",
+ "should support turning off character references"
+ );
}