@@ -9,6 +9,45 @@ enum Error {
9
9
Serde ( serde_json:: Error ) ,
10
10
}
11
11
12
+ #[ test]
13
+ #[ cfg( feature = "serde" ) ]
14
+ fn serde_constructs ( ) -> Result < ( ) , Error > {
15
+ use pretty_assertions:: assert_eq;
16
+
17
+ assert_eq ! (
18
+ serde_json:: to_string( & Constructs :: default ( ) ) . unwrap( ) ,
19
+ r#"{"attention":true,"autolink":true,"blockQuote":true,"characterEscape":true,"characterReference":true,"codeIndented":true,"codeFenced":true,"codeText":true,"definition":true,"frontmatter":false,"gfmAutolinkLiteral":false,"gfmFootnoteDefinition":false,"gfmLabelStartFootnote":false,"gfmStrikethrough":false,"gfmTable":false,"gfmTaskListItem":false,"hardBreakEscape":true,"hardBreakTrailing":true,"headingAtx":true,"headingSetext":true,"htmlFlow":true,"htmlText":true,"labelStartImage":true,"labelStartLink":true,"labelEnd":true,"listItem":true,"mathFlow":false,"mathText":false,"mdxEsm":false,"mdxExpressionFlow":false,"mdxExpressionText":false,"mdxJsxFlow":false,"mdxJsxText":false,"thematicBreak":true}"#
20
+ ) ;
21
+
22
+ Ok ( ( ) )
23
+ }
24
+
25
+ #[ test]
26
+ #[ cfg( feature = "serde" ) ]
27
+ fn serde_compile_options ( ) -> Result < ( ) , Error > {
28
+ use pretty_assertions:: assert_eq;
29
+
30
+ assert_eq ! (
31
+ serde_json:: to_string( & markdown:: CompileOptions :: gfm( ) ) . unwrap( ) ,
32
+ r#"{"allowAnyImgSrc":false,"allowDangerousHtml":false,"allowDangerousProtocol":false,"defaultLineEnding":"\n","gfmFootnoteBackLabel":null,"gfmFootnoteClobberPrefix":null,"gfmFootnoteLabelAttributes":null,"gfmFootnoteLabelTagName":null,"gfmFootnoteLabel":null,"gfmTaskListItemCheckable":false,"gfmTagfilter":true}"#
33
+ ) ;
34
+
35
+ Ok ( ( ) )
36
+ }
37
+
38
+ #[ test]
39
+ #[ cfg( feature = "serde" ) ]
40
+ fn serde_parse_options ( ) -> Result < ( ) , Error > {
41
+ use pretty_assertions:: assert_eq;
42
+
43
+ assert_eq ! (
44
+ serde_json:: to_string( & ParseOptions :: gfm( ) ) . unwrap( ) ,
45
+ r#"{"constructs":{"attention":true,"autolink":true,"blockQuote":true,"characterEscape":true,"characterReference":true,"codeIndented":true,"codeFenced":true,"codeText":true,"definition":true,"frontmatter":false,"gfmAutolinkLiteral":true,"gfmFootnoteDefinition":true,"gfmLabelStartFootnote":true,"gfmStrikethrough":true,"gfmTable":true,"gfmTaskListItem":true,"hardBreakEscape":true,"hardBreakTrailing":true,"headingAtx":true,"headingSetext":true,"htmlFlow":true,"htmlText":true,"labelStartImage":true,"labelStartLink":true,"labelEnd":true,"listItem":true,"mathFlow":false,"mathText":false,"mdxEsm":false,"mdxExpressionFlow":false,"mdxExpressionText":false,"mdxJsxFlow":false,"mdxJsxText":false,"thematicBreak":true},"gfmStrikethroughSingleTilde":true,"mathTextSingleDollar":true}"#
46
+ ) ;
47
+
48
+ Ok ( ( ) )
49
+ }
50
+
12
51
#[ test]
13
52
fn serde_blockquote ( ) -> Result < ( ) , Error > {
14
53
assert_serde (
@@ -680,9 +719,9 @@ fn serde_paragraph() -> Result<(), Error> {
680
719
)
681
720
}
682
721
683
- /// Assert serde of Mdast constructs.
722
+ /// Assert serde of mdast constructs.
684
723
///
685
- /// Refer below links for the MDAST JSON construct types.
724
+ /// Refer below links for the mdast JSON construct types.
686
725
/// * <https://github.com/syntax-tree/mdast#nodes>
687
726
/// * <https://github.com/syntax-tree/mdast-util-mdx#syntax-tree>
688
727
/// * <https://github.com/syntax-tree/mdast-util-frontmatter#syntax-tree>
@@ -705,6 +744,7 @@ fn assert_serde(input: &str, expected: &str, options: ParseOptions) -> Result<()
705
744
source,
706
745
serde_json:: from_value( actual_value) . map_err( Error :: Serde ) ?
707
746
) ;
747
+
708
748
Ok ( ( ) )
709
749
}
710
750
0 commit comments