@@ -67,6 +67,20 @@ defmodule ExUnit.Formatter do
67
67
load: pos_integer | nil
68
68
}
69
69
70
+ @ typedoc """
71
+ A function that this module calls to format various things.
72
+ """
73
+ @ typedoc since: "1.16.0"
74
+ @ type formatter_callback :: ( atom , term -> term )
75
+
76
+ @ typedoc """
77
+ Width for formatting.
78
+
79
+ For example, see `format_assertion_diff/4`.
80
+ """
81
+ @ typedoc since: "1.16.0"
82
+ @ type width :: non_neg_integer | :infinity
83
+
70
84
import Exception , only: [ format_stacktrace_entry: 1 , format_file_line: 3 ]
71
85
72
86
alias ExUnit.Diff
@@ -155,6 +169,14 @@ defmodule ExUnit.Formatter do
155
169
@ doc """
156
170
Receives a test and formats its failure.
157
171
"""
172
+ @ spec format_test_failure (
173
+ ExUnit.Test . t ( ) ,
174
+ [ failure ] ,
175
+ non_neg_integer ,
176
+ width ,
177
+ formatter_callback
178
+ ) :: String . t ( )
179
+ when failure: { atom , term , Exception . stacktrace ( ) }
158
180
def format_test_failure ( test , failures , counter , width , formatter ) do
159
181
% ExUnit.Test { name: name , module: module , tags: tags } = test
160
182
@@ -177,6 +199,14 @@ defmodule ExUnit.Formatter do
177
199
@ doc """
178
200
Receives a test module and formats its failure.
179
201
"""
202
+ @ spec format_test_all_failure (
203
+ ExUnit.TestModule . t ( ) ,
204
+ [ failure ] ,
205
+ non_neg_integer ,
206
+ width ,
207
+ formatter_callback
208
+ ) :: String . t ( )
209
+ when failure: { atom , term , Exception . stacktrace ( ) }
180
210
def format_test_all_failure ( test_module , failures , counter , width , formatter ) do
181
211
name = test_module . name
182
212
@@ -280,6 +310,12 @@ defmodule ExUnit.Formatter do
280
310
for formatted content, the width (may be `:infinity`),
281
311
and the formatter callback function.
282
312
"""
313
+ @ spec format_assertion_diff (
314
+ % ExUnit.AssertionError { } ,
315
+ non_neg_integer ,
316
+ width ,
317
+ formatter_callback
318
+ ) :: keyword
283
319
def format_assertion_diff ( assert_error , padding_size , width , formatter )
284
320
285
321
def format_assertion_diff ( % ExUnit.AssertionError { context: { :mailbox , _pins , [ ] } } , _ , _ , _ ) do
0 commit comments