From ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 13 Oct 2022 10:40:01 +0200 Subject: Rename crate to `markdown` --- tests/mdx_expression_flow.rs | 68 +++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 36 deletions(-) (limited to 'tests/mdx_expression_flow.rs') diff --git a/tests/mdx_expression_flow.rs b/tests/mdx_expression_flow.rs index 8217c94..b181ef7 100644 --- a/tests/mdx_expression_flow.rs +++ b/tests/mdx_expression_flow.rs @@ -1,8 +1,8 @@ -extern crate micromark; +extern crate markdown; mod test_utils; -use micromark::{ +use markdown::{ mdast::{MdxFlowExpression, Node, Root}, - micromark_to_mdast, micromark_with_options, + to_html_with_options, to_mdast, unist::Position, Constructs, Options, ParseOptions, }; @@ -20,49 +20,49 @@ fn mdx_expression_flow_agnostic() -> Result<(), String> { }; assert_eq!( - micromark_with_options("{a}", &mdx)?, + to_html_with_options("{a}", &mdx)?, "", "should support an expression" ); assert_eq!( - micromark_with_options("{}", &mdx)?, + to_html_with_options("{}", &mdx)?, "", "should support an empty expression" ); assert_eq!( - micromark_with_options("{a", &mdx).err().unwrap(), + to_html_with_options("{a", &mdx).err().unwrap(), "1:3: Unexpected end of file in expression, expected a corresponding closing brace for `{`", "should crash if no closing brace is found (1)" ); assert_eq!( - micromark_with_options("{b { c }", &mdx).err().unwrap(), + to_html_with_options("{b { c }", &mdx).err().unwrap(), "1:9: Unexpected end of file in expression, expected a corresponding closing brace for `{`", "should crash if no closing brace is found (2)" ); assert_eq!( - micromark_with_options("{\n}\na", &mdx)?, + to_html_with_options("{\n}\na", &mdx)?, "

a

", "should support a line ending in an expression" ); assert_eq!( - micromark_with_options("{ a } \t\nb", &mdx)?, + to_html_with_options("{ a } \t\nb", &mdx)?, "

b

", "should support expressions followed by spaces" ); assert_eq!( - micromark_with_options(" { a }\nb", &mdx)?, + to_html_with_options(" { a }\nb", &mdx)?, "

b

", "should support expressions preceded by spaces" ); assert_eq!( - micromark_with_options("> {a\nb}", &mdx) + to_html_with_options("> {a\nb}", &mdx) .err() .unwrap(), "2:1: Unexpected lazy line in expression in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc", @@ -70,19 +70,19 @@ fn mdx_expression_flow_agnostic() -> Result<(), String> { ); assert_eq!( - micromark_with_options("> a\n{b}", &mdx)?, + to_html_with_options("> a\n{b}", &mdx)?, "
\n

a

\n
\n", "should not support lazyness (2)" ); assert_eq!( - micromark_with_options("> {a}\nb", &mdx)?, + to_html_with_options("> {a}\nb", &mdx)?, "
\n
\n

b

", "should not support lazyness (3)" ); assert_eq!( - micromark_with_options("> {\n> a\nb}", &mdx) + to_html_with_options("> {\n> a\nb}", &mdx) .err() .unwrap(), "3:1: Unexpected lazy line in expression in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc", @@ -90,7 +90,7 @@ fn mdx_expression_flow_agnostic() -> Result<(), String> { ); assert_eq!( - micromark_to_mdast("{alpha +\nbravo}", &mdx.parse)?, + to_mdast("{alpha +\nbravo}", &mdx.parse)?, Node::Root(Root { children: vec![Node::MdxFlowExpression(MdxFlowExpression { value: "alpha +\nbravo".into(), @@ -118,61 +118,61 @@ fn mdx_expression_flow_gnostic() -> Result<(), String> { }; assert_eq!( - micromark_with_options("{a}", &swc)?, + to_html_with_options("{a}", &swc)?, "", "should support an expression" ); assert_eq!( - micromark_with_options("{}", &swc)?, + to_html_with_options("{}", &swc)?, "", "should support an empty expression" ); assert_eq!( - micromark_with_options("{a", &swc).err().unwrap(), + to_html_with_options("{a", &swc).err().unwrap(), "1:3: Unexpected end of file in expression, expected a corresponding closing brace for `{`", "should crash if no closing brace is found (1)" ); assert_eq!( - micromark_with_options("{b { c }", &swc).err().unwrap(), + to_html_with_options("{b { c }", &swc).err().unwrap(), "1:4: Could not parse expression with swc: Unexpected content after expression", "should crash if no closing brace is found (2)" ); assert_eq!( - micromark_with_options("{\n}\na", &swc)?, + to_html_with_options("{\n}\na", &swc)?, "

a

", "should support a line ending in an expression" ); assert_eq!( - micromark_with_options("{ a } \t\nb", &swc)?, + to_html_with_options("{ a } \t\nb", &swc)?, "

b

", "should support expressions followed by spaces" ); assert_eq!( - micromark_with_options(" { a }\nb", &swc)?, + to_html_with_options(" { a }\nb", &swc)?, "

b

", "should support expressions preceded by spaces" ); assert_eq!( - micromark_with_options(" {`\n a\n `}", &swc)?, + to_html_with_options(" {`\n a\n `}", &swc)?, "", "should support indented expressions" ); assert_eq!( - micromark_with_options("a{(b)}c", &swc)?, + to_html_with_options("a{(b)}c", &swc)?, "

ac

", "should support expressions padded w/ parens" ); assert_eq!( - micromark_with_options("a{/* b */ ( (c) /* d */ + (e) )}f", &swc)?, + to_html_with_options("a{/* b */ ( (c) /* d */ + (e) )}f", &swc)?, "

af

", "should support expressions padded w/ parens and comments" ); @@ -193,47 +193,43 @@ fn mdx_expression_spread() -> Result<(), String> { }; assert_eq!( - micromark_with_options("", &swc)?, + to_html_with_options("", &swc)?, "", "should support spreads for attribute expression" ); assert_eq!( - micromark_with_options("", &swc).err().unwrap(), + to_html_with_options("", &swc).err().unwrap(), "1:5: Expected a single spread value, such as `...x`", "should crash if not a spread" ); assert_eq!( - micromark_with_options("", &swc).err().unwrap(), + to_html_with_options("", &swc).err().unwrap(), "1:13: Could not parse expression with swc: Unexpected token `?`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, ` for template literal, (, or an identifier", "should crash on an incorrect spread" ); assert_eq!( - micromark_with_options("", &swc) - .err() - .unwrap(), + to_html_with_options("", &swc).err().unwrap(), "1:5: Expected a single spread value, such as `...x`", "should crash if a spread and other things" ); assert_eq!( - micromark_with_options("", &swc).err().unwrap(), + to_html_with_options("", &swc).err().unwrap(), "1:5: Expected a single spread value, such as `...x`", "should crash on an empty spread" ); assert_eq!( - micromark_with_options("", &swc).err().unwrap(), + to_html_with_options("", &swc).err().unwrap(), "1:12: Could not parse expression with swc: assignment property is invalid syntax", "should crash if not an identifier" ); assert_eq!( - micromark_with_options("", &swc) - .err() - .unwrap(), + to_html_with_options("", &swc).err().unwrap(), "1:5: Expected a single spread value, such as `...x`", "should crash on a comment spread" ); -- cgit