@@ -37,6 +37,7 @@ fn fuzz_doesnt_crash(md: String) {
3737 width : 80 ,
3838 unsafe_ : true ,
3939 escape : false ,
40+ list_style : :: ListStyleType :: Dash ,
4041 } ,
4142 } ;
4243
@@ -62,12 +63,12 @@ fn compare_strs(output: &str, expected: &str, kind: &str) {
6263}
6364
6465#[ track_caller]
65- fn commonmark ( input : & str , expected : & str ) {
66+ fn commonmark ( input : & str , expected : & str , opts : Option < & :: ComrakOptions > ) {
6667 let arena = :: Arena :: new ( ) ;
67- let mut options = :: ComrakOptions :: default ( ) ;
68- options. render . width = 72 ;
68+ let defaults = :: ComrakOptions :: default ( ) ;
69+ let options = opts . unwrap_or ( & defaults ) ;
6970
70- let root = :: parse_document ( & arena, input, & options) ;
71+ let root = :: parse_document ( & arena, input, options) ;
7172 let mut output = vec ! [ ] ;
7273 cm:: format_document ( root, & options, & mut output) . unwrap ( ) ;
7374 compare_strs ( & String :: from_utf8 ( output) . unwrap ( ) , expected, "regular" ) ;
@@ -253,6 +254,31 @@ fn lists() {
253254 ) ;
254255}
255256
257+ #[ test]
258+ fn markdown_list_bullets ( ) {
259+ let dash = concat ! ( "- a\n " ) ;
260+ let plus = concat ! ( "+ a\n " ) ;
261+ let star = concat ! ( "* a\n " ) ;
262+ let mut dash_opts = :: ComrakOptions :: default ( ) ;
263+ dash_opts. render . list_style = :: ListStyleType :: Dash ;
264+ let mut plus_opts = :: ComrakOptions :: default ( ) ;
265+ plus_opts. render . list_style = :: ListStyleType :: Plus ;
266+ let mut star_opts = :: ComrakOptions :: default ( ) ;
267+ star_opts. render . list_style = :: ListStyleType :: Star ;
268+
269+ commonmark ( dash, dash, Some ( & dash_opts) ) ;
270+ commonmark ( plus, dash, Some ( & dash_opts) ) ;
271+ commonmark ( star, dash, Some ( & dash_opts) ) ;
272+
273+ commonmark ( dash, plus, Some ( & plus_opts) ) ;
274+ commonmark ( plus, plus, Some ( & plus_opts) ) ;
275+ commonmark ( star, plus, Some ( & plus_opts) ) ;
276+
277+ commonmark ( dash, star, Some ( & star_opts) ) ;
278+ commonmark ( plus, star, Some ( & star_opts) ) ;
279+ commonmark ( star, star, Some ( & star_opts) ) ;
280+ }
281+
256282#[ test]
257283fn thematic_breaks ( ) {
258284 html (
@@ -263,6 +289,8 @@ fn thematic_breaks() {
263289
264290#[ test]
265291fn width_breaks ( ) {
292+ let mut options = :: ComrakOptions :: default ( ) ;
293+ options. render . width = 72 ;
266294 let input = concat ! (
267295 "this should break because it has breakable characters. break right here newline\n " ,
268296 "\n " ,
@@ -279,7 +307,7 @@ fn width_breaks() {
279307 "a-long-line-that-won't-break-because-there-is-no-character-it-can-break-on\n "
280308 ) ;
281309
282- commonmark ( input, output) ;
310+ commonmark ( input, output, Some ( & options ) ) ;
283311}
284312
285313#[ test]
@@ -1272,6 +1300,7 @@ fn exercise_full_api<'a>() {
12721300 width : 123456 ,
12731301 unsafe_ : false ,
12741302 escape : false ,
1303+ list_style : :: ListStyleType :: Dash ,
12751304 } ,
12761305 } ;
12771306
0 commit comments