From cd5bb2d16c6b28332b0b6077b27b2b90a8051896 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 6 Oct 2022 15:57:55 +0200 Subject: Refactor to split parse from compile options --- tests/gfm_footnote.rs | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) (limited to 'tests/gfm_footnote.rs') diff --git a/tests/gfm_footnote.rs b/tests/gfm_footnote.rs index 364bf90..29b0092 100644 --- a/tests/gfm_footnote.rs +++ b/tests/gfm_footnote.rs @@ -3,14 +3,17 @@ use micromark::{ mdast::{FootnoteDefinition, FootnoteReference, 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 gfm_footnote() -> Result<(), String> { let gfm = Options { - constructs: Constructs::gfm(), + parse: ParseOptions { + constructs: Constructs::gfm(), + ..ParseOptions::default() + }, ..Options::default() }; @@ -38,10 +41,15 @@ fn gfm_footnote() -> Result<(), String> { micromark_with_options( "Noot.[^a]\n\n[^a]: dingen", &Options { - constructs: Constructs::gfm(), + parse: ParseOptions { + constructs: Constructs::gfm(), + ..ParseOptions::default() + }, + compile: CompileOptions { gfm_footnote_label: Some("Voetnoten".to_string()), gfm_footnote_back_label: Some("Terug naar de inhoud".to_string()), - ..Options::default() + ..CompileOptions::default() + } } )?, "

Noot.1

@@ -60,9 +68,14 @@ fn gfm_footnote() -> Result<(), String> { micromark_with_options( "[^a]\n\n[^a]: b", &Options { - constructs: Constructs::gfm(), + parse: ParseOptions { + constructs: Constructs::gfm(), + ..ParseOptions::default() + }, + compile: CompileOptions { gfm_footnote_label_tag_name: Some("h1".to_string()), - ..Options::default() + ..CompileOptions::default() + } } )?, "

1

@@ -81,9 +94,14 @@ fn gfm_footnote() -> Result<(), String> { micromark_with_options( "[^a]\n\n[^a]: b", &Options { - constructs: Constructs::gfm(), + parse: ParseOptions { + constructs: Constructs::gfm(), + ..ParseOptions::default() + }, + compile: CompileOptions { gfm_footnote_label_attributes: Some("class=\"footnote-heading\"".to_string()), - ..Options::default() + ..CompileOptions::default() + } } )?, "

1

@@ -102,9 +120,14 @@ fn gfm_footnote() -> Result<(), String> { micromark_with_options( "[^a]\n\n[^a]: b", &Options { - constructs: Constructs::gfm(), - gfm_footnote_clobber_prefix: Some("".to_string()), - ..Options::default() + parse: ParseOptions { + constructs: Constructs::gfm(), + ..ParseOptions::default() + }, + compile: CompileOptions { + gfm_footnote_clobber_prefix: Some("".to_string()), + ..CompileOptions::default() + } } )?, "

1

@@ -1603,7 +1626,7 @@ multi-paragraph list items.