File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ fn write_fn(
116
116
write_desc ( ctxt, doc. desc ) ;
117
117
write_args ( ctxt, doc. args ) ;
118
118
write_return ( ctxt, doc. return ) ;
119
+ write_failure ( ctxt, doc. failure ) ;
119
120
}
120
121
121
122
fn write_sig ( ctxt : ctxt , sig : option < str > ) {
@@ -304,6 +305,25 @@ fn should_write_return_description_on_same_line_as_type() {
304
305
assert str:: contains ( markdown, "Returns `int` - blorp" ) ;
305
306
}
306
307
308
+ fn write_failure ( ctxt : ctxt , str : option < str > ) {
309
+ alt str {
310
+ some( str) {
311
+ ctxt. w . write_line ( #fmt ( "Failure conditions: %s" , str) ) ;
312
+ ctxt. w . write_line ( "" ) ;
313
+ }
314
+ none { }
315
+ }
316
+ }
317
+
318
+ #[ test]
319
+ fn should_write_failure_conditions ( ) {
320
+ let markdown = test:: render (
321
+ "#[doc(failure = \" it's the fail\" )] fn a () { }" ) ;
322
+ assert str:: contains (
323
+ markdown,
324
+ "\n \n Failure conditions: it's the fail\n \n " ) ;
325
+ }
326
+
307
327
fn write_const (
308
328
ctxt : ctxt ,
309
329
doc : doc:: constdoc
You can’t perform that action at this time.
0 commit comments