aboutsummaryrefslogtreecommitdiffstats
path: root/tests/code_text.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/code_text.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/code_text.rs36
1 files changed, 22 insertions, 14 deletions
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`"),
"<p><code>foo</code></p>",
@@ -106,7 +106,7 @@ fn code_text() {
);
assert_eq!(
- micromark_with_options("<a href=\"`\">`", DANGER),
+ micromark_with_options("<a href=\"`\">`", &danger),
"<p><a href=\"`\">`</p>",
"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"]}}]}),
- // "<p>`a`</p>",
- // "should support turning off code (text)"
- // );
+ assert_eq!(
+ micromark_with_options(
+ "`a`",
+ &Options {
+ constructs: Constructs {
+ code_text: false,
+ ..Constructs::default()
+ },
+ ..Options::default()
+ }
+ ),
+ "<p>`a`</p>",
+ "should support turning off code (text)"
+ );
}