From e485745c6924e41f2896f579b5454cfb800e13f6 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 28 Oct 2022 18:28:12 +0200 Subject: Fix GFM tables to require a non-pipe in header row Related-to: GH-20. --- tests/gfm_table.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/gfm_table.rs') diff --git a/tests/gfm_table.rs b/tests/gfm_table.rs index db1c364..c8f20ef 100644 --- a/tests/gfm_table.rs +++ b/tests/gfm_table.rs @@ -129,6 +129,24 @@ fn gfm_table() -> Result<(), String> { "should support empty body cells" ); + assert_eq!( + to_html_with_options(":\n|-|\n|a|\n\nb\n|-|\n|c|\n\n|\n|-|\n|d|\n\n|\n|-|\n|e|\n\n|:\n|-|\n|f|\n\n||\n|-|\n|g|\n\n| |\n|-|\n|h|\n", &Options::gfm())?, + "\n\n\n\n\n\n\n\n\n\n\n
:
a
\n\n\n\n\n\n\n\n\n\n\n\n
b
c
\n

|\n|-|\n|d|

\n

|\n|-|\n|e|

\n\n\n\n\n\n\n\n\n\n\n\n
:
f
\n\n\n\n\n\n\n\n\n\n\n\n
g
\n\n\n\n\n\n\n\n\n\n\n\n
h
\n", + "should need any character other than a single pipe in the header row" + ); + + assert_eq!( + to_html_with_options("a\n|-\n\nb\n||\n\nc\n|-|\n\nd\n|:|\n\ne\n| |\n\nf\n| -|\n\ng\n|- |\n", &Options::gfm())?, + "\n\n\n\n\n\n
a
\n

b\n||

\n\n\n\n\n\n\n
c
\n

d\n|:|

\n

e\n| |

\n\n\n\n\n\n\n
f
\n\n\n\n\n\n\n
g
\n", + "should need a dash in the delimimter row" + ); + + assert_eq!( + to_html_with_options("|\n|", &Options::gfm())?, + "

|\n|

", + "should need something" + ); + assert_eq!( to_html_with_options("| a |\n| - |\n- b", &Options::gfm())?, "\n\n\n\n\n\n
a
\n", -- cgit