aboutsummaryrefslogtreecommitdiffstats
path: root/tests/c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/character_escape.rs20
-rw-r--r--tests/character_reference.rs19
-rw-r--r--tests/code_fenced.rs15
-rw-r--r--tests/code_indented.rs28
-rw-r--r--tests/code_text.rs20
-rw-r--r--tests/commonmark.rs9
6 files changed, 72 insertions, 39 deletions
diff --git a/tests/character_escape.rs b/tests/character_escape.rs
index 44eff0b..54944aa 100644
--- a/tests/character_escape.rs
+++ b/tests/character_escape.rs
@@ -3,15 +3,18 @@ use micromark::{
mdast::{Node, Paragraph, Root, Text},
micromark, micromark_to_mdast, micromark_with_options,
unist::Position,
- Constructs, Options,
+ CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn character_escape() -> Result<(), String> {
let danger = Options {
- allow_dangerous_html: true,
- allow_dangerous_protocol: true,
+ compile: CompileOptions {
+ allow_dangerous_html: true,
+ allow_dangerous_protocol: true,
+ ..CompileOptions::default()
+ },
..Options::default()
};
@@ -87,9 +90,12 @@ fn character_escape() -> Result<(), String> {
micromark_with_options(
"\\> a",
&Options {
- constructs: Constructs {
- character_escape: false,
- ..Constructs::default()
+ parse: ParseOptions {
+ constructs: Constructs {
+ character_escape: false,
+ ..Constructs::default()
+ },
+ ..ParseOptions::default()
},
..Options::default()
}
@@ -99,7 +105,7 @@ fn character_escape() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a \\* b", &Options::default())?,
+ micromark_to_mdast("a \\* b", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![Node::Text(Text {
diff --git a/tests/character_reference.rs b/tests/character_reference.rs
index ccf506e..1cc732e 100644
--- a/tests/character_reference.rs
+++ b/tests/character_reference.rs
@@ -3,7 +3,7 @@ use micromark::{
mdast::{Node, Paragraph, Root, Text},
micromark, micromark_to_mdast, micromark_with_options,
unist::Position,
- Constructs, Options,
+ CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
@@ -52,7 +52,11 @@ fn character_reference() -> Result<(), String> {
micromark_with_options(
"<a href=\"&ouml;&ouml;.html\">",
&Options {
- allow_dangerous_html: true,
+ compile: CompileOptions {
+ allow_dangerous_html: true,
+ allow_dangerous_protocol: true,
+ ..CompileOptions::default()
+ },
..Options::default()
}
)?,
@@ -197,9 +201,12 @@ fn character_reference() -> Result<(), String> {
micromark_with_options(
"&amp;",
&Options {
- constructs: Constructs {
- character_reference: false,
- ..Constructs::default()
+ parse: ParseOptions {
+ constructs: Constructs {
+ character_reference: false,
+ ..Constructs::default()
+ },
+ ..ParseOptions::default()
},
..Options::default()
}
@@ -209,7 +216,7 @@ fn character_reference() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("&nbsp; &amp; &copy; &AElig; &Dcaron;\n&frac34; &HilbertSpace; &DifferentialD;\n&ClockwiseContourIntegral; &ngE;", &Options::default())?,
+ micromark_to_mdast("&nbsp; &amp; &copy; &AElig; &Dcaron;\n&frac34; &HilbertSpace; &DifferentialD;\n&ClockwiseContourIntegral; &ngE;", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![Node::Text(Text {
diff --git a/tests/code_fenced.rs b/tests/code_fenced.rs
index 06f0d6a..6da38a9 100644
--- a/tests/code_fenced.rs
+++ b/tests/code_fenced.rs
@@ -3,7 +3,7 @@ use micromark::{
mdast::{Code, Node, Root},
micromark, micromark_to_mdast, micromark_with_options,
unist::Position,
- Constructs, Options,
+ Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
@@ -266,9 +266,12 @@ fn code_fenced() -> Result<(), String> {
micromark_with_options(
"```",
&Options {
- constructs: Constructs {
- code_fenced: false,
- ..Constructs::default()
+ parse: ParseOptions {
+ constructs: Constructs {
+ code_fenced: false,
+ ..Constructs::default()
+ },
+ ..ParseOptions::default()
},
..Options::default()
}
@@ -280,7 +283,7 @@ fn code_fenced() -> Result<(), String> {
assert_eq!(
micromark_to_mdast(
"```js extra\nconsole.log(1)\nconsole.log(2)\n```",
- &Options::default()
+ &ParseOptions::default()
)?,
Node::Root(Root {
children: vec![Node::Code(Code {
@@ -295,7 +298,7 @@ fn code_fenced() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("```\nasd", &Options::default())?,
+ micromark_to_mdast("```\nasd", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Code(Code {
lang: None,
diff --git a/tests/code_indented.rs b/tests/code_indented.rs
index 7ea08b5..fd539d3 100644
--- a/tests/code_indented.rs
+++ b/tests/code_indented.rs
@@ -3,7 +3,7 @@ use micromark::{
mdast::{Code, Node, Root},
micromark, micromark_to_mdast, micromark_with_options,
unist::Position,
- Constructs, Options,
+ CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
@@ -124,9 +124,12 @@ fn code_indented() -> Result<(), String> {
);
let off = Options {
- constructs: Constructs {
- code_indented: false,
- ..Constructs::default()
+ parse: ParseOptions {
+ constructs: Constructs {
+ code_indented: false,
+ ..Constructs::default()
+ },
+ ..ParseOptions::default()
},
..Options::default()
};
@@ -171,12 +174,17 @@ fn code_indented() -> Result<(), String> {
micromark_with_options(
"a <?\n ?>",
&Options {
- allow_dangerous_html: true,
- constructs: Constructs {
- code_indented: false,
- ..Constructs::default()
+ parse: ParseOptions {
+ constructs: Constructs {
+ code_indented: false,
+ ..Constructs::default()
+ },
+ ..ParseOptions::default()
},
- ..Options::default()
+ compile: CompileOptions {
+ allow_dangerous_html: true,
+ ..CompileOptions::default()
+ }
}
)?,
"<p>a <?\n?></p>",
@@ -198,7 +206,7 @@ fn code_indented() -> Result<(), String> {
assert_eq!(
micromark_to_mdast(
"\tconsole.log(1)\n console.log(2)\n",
- &Options::default()
+ &ParseOptions::default()
)?,
Node::Root(Root {
children: vec![Node::Code(Code {
diff --git a/tests/code_text.rs b/tests/code_text.rs
index f6a3379..25882c8 100644
--- a/tests/code_text.rs
+++ b/tests/code_text.rs
@@ -3,15 +3,18 @@ use micromark::{
mdast::{InlineCode, Node, Paragraph, Root, Text},
micromark, micromark_to_mdast, micromark_with_options,
unist::Position,
- Constructs, Options,
+ CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn code_text() -> Result<(), String> {
let danger = Options {
- allow_dangerous_html: true,
- allow_dangerous_protocol: true,
+ compile: CompileOptions {
+ allow_dangerous_html: true,
+ allow_dangerous_protocol: true,
+ ..CompileOptions::default()
+ },
..Options::default()
};
@@ -164,9 +167,12 @@ fn code_text() -> Result<(), String> {
micromark_with_options(
"`a`",
&Options {
- constructs: Constructs {
- code_text: false,
- ..Constructs::default()
+ parse: ParseOptions {
+ constructs: Constructs {
+ code_text: false,
+ ..Constructs::default()
+ },
+ ..ParseOptions::default()
},
..Options::default()
}
@@ -176,7 +182,7 @@ fn code_text() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a `alpha` b.", &Options::default())?,
+ micromark_to_mdast("a `alpha` b.", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
diff --git a/tests/commonmark.rs b/tests/commonmark.rs
index e96623a..cc3d69a 100644
--- a/tests/commonmark.rs
+++ b/tests/commonmark.rs
@@ -4,15 +4,18 @@
// > It is generate from the latest CommonMark website.
extern crate micromark;
-use micromark::{micromark_with_options, Options};
+use micromark::{micromark_with_options, CompileOptions, Options};
use pretty_assertions::assert_eq;
#[rustfmt::skip]
#[test]
fn commonmark() -> Result<(), String> {
let danger = Options {
- allow_dangerous_html: true,
- allow_dangerous_protocol: true,
+ compile: CompileOptions {
+ allow_dangerous_html: true,
+ allow_dangerous_protocol: true,
+ ..CompileOptions::default()
+ },
..Options::default()
};