diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-10-14 10:49:28 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-10-14 10:49:28 +0200 |
commit | 246063fb7cd21a83beae5934f95b2795fb85df51 (patch) | |
tree | 5f82a11d17ea5468376693c7a0405ed71d7ae147 /tests/gfm_task_list_item.rs | |
parent | 9cc1ad4a90616b7fb4ae7b425a5b9844887f4584 (diff) | |
download | markdown-rs-246063fb7cd21a83beae5934f95b2795fb85df51.tar.gz markdown-rs-246063fb7cd21a83beae5934f95b2795fb85df51.tar.bz2 markdown-rs-246063fb7cd21a83beae5934f95b2795fb85df51.zip |
Refactor to use default trait in tests
Diffstat (limited to 'tests/gfm_task_list_item.rs')
-rw-r--r-- | tests/gfm_task_list_item.rs | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/tests/gfm_task_list_item.rs b/tests/gfm_task_list_item.rs index 0ef6ea3..7c68b21 100644 --- a/tests/gfm_task_list_item.rs +++ b/tests/gfm_task_list_item.rs @@ -3,20 +3,12 @@ use markdown::{ mdast::{List, ListItem, Node, Paragraph, Root, Text}, to_html, to_html_with_options, to_mdast, unist::Position, - Constructs, Options, ParseOptions, + Options, ParseOptions, }; use pretty_assertions::assert_eq; #[test] fn gfm_task_list_item() -> Result<(), String> { - let gfm = Options { - parse: ParseOptions { - constructs: Constructs::gfm(), - ..ParseOptions::default() - }, - ..Options::default() - }; - assert_eq!( to_html("* [x] y."), "<ul>\n<li>[x] y.</li>\n</ul>", @@ -24,25 +16,25 @@ fn gfm_task_list_item() -> Result<(), String> { ); assert_eq!( - to_html_with_options("* [x] y.", &gfm)?, + to_html_with_options("* [x] y.", &Options::gfm())?, "<ul>\n<li><input type=\"checkbox\" disabled=\"\" checked=\"\" /> y.</li>\n</ul>", "should support task list item checks" ); assert_eq!( - to_html_with_options("* [ ] z.", &gfm)?, + to_html_with_options("* [ ] z.", &Options::gfm())?, "<ul>\n<li><input type=\"checkbox\" disabled=\"\" /> z.</li>\n</ul>", "should support unchecked task list item checks" ); assert_eq!( - to_html_with_options("*\n [x]", &gfm)?, + to_html_with_options("*\n [x]", &Options::gfm())?, "<ul>\n<li>[x]</li>\n</ul>", "should not support laziness (1)" ); assert_eq!( - to_html_with_options("*\n[x]", &gfm)?, + to_html_with_options("*\n[x]", &Options::gfm())?, "<ul>\n<li></li>\n</ul>\n<p>[x]</p>", "should not support laziness (2)" ); @@ -129,7 +121,7 @@ EOL after: "### .replace('␠', " ") .replace('␉', "\t"), - &gfm + &Options::gfm() )?, r###"<ul> <li><input type="checkbox" disabled="" /> foo</li> @@ -249,7 +241,7 @@ Text.</li> ); assert_eq!( - to_mdast("* [x] a\n* [ ] b\n* c", &gfm.parse)?, + to_mdast("* [x] a\n* [ ] b\n* c", &ParseOptions::gfm())?, Node::Root(Root { children: vec![Node::List(List { ordered: false, |