@@ -198,6 +198,7 @@ pub enum MdxExpressionKind {
198
198
/// Can be passed as `mdx_expression_parse` in [`ParseOptions`][] to support
199
199
/// expressions according to a certain grammar (typically, a programming
200
200
/// language).
201
+ ///
201
202
pub type MdxExpressionParse = dyn Fn ( & str , & MdxExpressionKind ) -> MdxSignal ;
202
203
203
204
/// Control which constructs are enabled.
@@ -1579,6 +1580,9 @@ mod tests {
1579
1580
1580
1581
#[ test]
1581
1582
fn test_constructs ( ) {
1583
+ #![ allow( unused_must_use) ]
1584
+ Constructs :: default ( ) ;
1585
+
1582
1586
let constructs = Constructs :: default ( ) ;
1583
1587
assert ! ( constructs. attention, "should default to `CommonMark` (1)" ) ;
1584
1588
assert ! (
@@ -1618,6 +1622,9 @@ mod tests {
1618
1622
1619
1623
#[ test]
1620
1624
fn test_parse_options ( ) {
1625
+ #![ allow( unused_must_use) ]
1626
+ ParseOptions :: default ( ) ;
1627
+
1621
1628
let options = ParseOptions :: default ( ) ;
1622
1629
assert ! (
1623
1630
options. constructs. attention,
@@ -1682,6 +1689,9 @@ mod tests {
1682
1689
1683
1690
#[ test]
1684
1691
fn test_compile_options ( ) {
1692
+ #![ allow( unused_must_use) ]
1693
+ CompileOptions :: default ( ) ;
1694
+
1685
1695
let options = CompileOptions :: default ( ) ;
1686
1696
assert ! (
1687
1697
!options. allow_dangerous_html,
@@ -1705,6 +1715,9 @@ mod tests {
1705
1715
1706
1716
#[ test]
1707
1717
fn test_options ( ) {
1718
+ #![ allow( unused_must_use) ]
1719
+ Options :: default ( ) ;
1720
+
1708
1721
let options = Options :: default ( ) ;
1709
1722
assert ! (
1710
1723
options. parse. constructs. attention,
@@ -1744,6 +1757,9 @@ mod tests {
1744
1757
1745
1758
#[ test]
1746
1759
fn test_to_html ( ) {
1760
+ #![ allow( unused_must_use) ]
1761
+ to_html ( "a" ) ;
1762
+
1747
1763
assert_eq ! (
1748
1764
to_html( "a" ) ,
1749
1765
"<p>a</p>" ,
@@ -1753,6 +1769,9 @@ mod tests {
1753
1769
1754
1770
#[ test]
1755
1771
fn test_to_html_with_options ( ) {
1772
+ #![ allow( unused_must_use) ]
1773
+ to_html_with_options ( "a" , & Options :: default ( ) ) ;
1774
+
1756
1775
assert_eq ! (
1757
1776
to_html_with_options( "a" , & Options :: default ( ) ) . unwrap( ) ,
1758
1777
"<p>a</p>" ,
@@ -1762,6 +1781,9 @@ mod tests {
1762
1781
1763
1782
#[ test]
1764
1783
fn test_to_mdast ( ) {
1784
+ #![ allow( unused_must_use) ]
1785
+ to_mdast ( "a" , & ParseOptions :: default ( ) ) ;
1786
+
1765
1787
assert ! (
1766
1788
matches!(
1767
1789
to_mdast( "a" , & ParseOptions :: default ( ) ) . unwrap( ) ,
@@ -1770,4 +1792,42 @@ mod tests {
1770
1792
"should support turning markdown into mdast with `to_mdast`"
1771
1793
) ;
1772
1794
}
1795
+
1796
+ #[ test]
1797
+ fn test_mdx_expression_parse ( ) {
1798
+ fn func ( _value : & str , _kind : & MdxExpressionKind ) -> MdxSignal {
1799
+ MdxSignal :: Ok
1800
+ }
1801
+
1802
+ let func_accepting = |_a : Box < MdxExpressionParse > | true ;
1803
+
1804
+ assert ! (
1805
+ matches!( func( "a" , & MdxExpressionKind :: Expression ) , MdxSignal :: Ok ) ,
1806
+ "should expose an `MdxExpressionParse` type (1)"
1807
+ ) ;
1808
+
1809
+ assert ! (
1810
+ func_accepting( Box :: new( func) ) ,
1811
+ "should expose an `MdxExpressionParse` type (2)"
1812
+ ) ;
1813
+ }
1814
+
1815
+ #[ test]
1816
+ fn test_mdx_esm_parse ( ) {
1817
+ fn func ( _value : & str ) -> MdxSignal {
1818
+ MdxSignal :: Ok
1819
+ }
1820
+
1821
+ let func_accepting = |_a : Box < MdxEsmParse > | true ;
1822
+
1823
+ assert ! (
1824
+ matches!( func( "a" ) , MdxSignal :: Ok ) ,
1825
+ "should expose an `MdxEsmParse` type (1)"
1826
+ ) ;
1827
+
1828
+ assert ! (
1829
+ func_accepting( Box :: new( func) ) ,
1830
+ "should expose an `MdxEsmParse` type (2)"
1831
+ ) ;
1832
+ }
1773
1833
}
0 commit comments