@@ -81,6 +81,10 @@ fn write_mod_contents(
81
81
write_brief ( ctxt, doc. brief ) ;
82
82
write_desc ( ctxt, doc. desc ) ;
83
83
84
+ for constdoc in * doc. consts {
85
+ write_const ( ctxt, constdoc) ;
86
+ }
87
+
84
88
for fndoc in * doc. fns {
85
89
write_fn ( ctxt, fndoc) ;
86
90
}
@@ -300,6 +304,30 @@ fn should_write_return_description_on_same_line_as_type() {
300
304
assert str:: contains ( markdown, "Returns `int` - blorp" ) ;
301
305
}
302
306
307
+ fn write_const (
308
+ ctxt : ctxt ,
309
+ doc : doc:: constdoc
310
+ ) {
311
+ write_header ( ctxt, h3, #fmt ( "Const `%s`" , doc. name ) ) ;
312
+ write_sig ( ctxt, doc. ty ) ;
313
+ write_brief ( ctxt, doc. brief ) ;
314
+ write_desc ( ctxt, doc. desc ) ;
315
+ }
316
+
317
+ #[ test]
318
+ fn should_write_const_header ( ) {
319
+ let markdown = test:: render ( "const a: bool = true;" ) ;
320
+ assert str:: contains ( markdown, "### Const `a`\n \n " ) ;
321
+ }
322
+
323
+ #[ test]
324
+ fn should_write_const_description ( ) {
325
+ let markdown = test:: render (
326
+ "#[doc(brief = \" a\" , desc = \" b\" )]\
327
+ const a: bool = true;") ;
328
+ assert str:: contains ( markdown, "\n \n a\n \n b\n \n " ) ;
329
+ }
330
+
303
331
#[ cfg( test) ]
304
332
mod test {
305
333
fn render ( source : str ) -> str {
0 commit comments