Skip to content

Commit adff7f6

Browse files
whatyouhidejosevalim
authored andcommitted
Add t/0 types for some ExUnit exceptions (#13134)
1 parent 2364f04 commit adff7f6

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

lib/ex_unit/lib/ex_unit/assertions.ex

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
defmodule ExUnit.AssertionError do
22
@moduledoc """
33
Raised to signal an assertion error.
4+
5+
This is used by macros such as `ExUnit.Assertions.assert/1`.
46
"""
57

68
@no_value :ex_unit_no_meaningful_value
79

10+
@typedoc since: "1.16.0"
11+
@type t :: %__MODULE__{
12+
left: any,
13+
right: any,
14+
message: any,
15+
expr: any,
16+
args: any,
17+
doctest: any,
18+
context: any
19+
}
20+
821
defexception left: @no_value,
922
right: @no_value,
1023
message: @no_value,
@@ -16,6 +29,7 @@ defmodule ExUnit.AssertionError do
1629
@doc """
1730
Indicates no meaningful value for a field.
1831
"""
32+
@spec no_value :: atom
1933
def no_value do
2034
@no_value
2135
end
@@ -31,6 +45,11 @@ defmodule ExUnit.MultiError do
3145
Raised to signal multiple errors happened in a test case.
3246
"""
3347

48+
@typedoc since: "1.16.0"
49+
@type t :: %__MODULE__{
50+
errors: [{Exception.kind(), any, Exception.stacktrace()}]
51+
}
52+
3453
defexception errors: []
3554

3655
@impl true

lib/ex_unit/lib/ex_unit/formatter.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ defmodule ExUnit.Formatter do
418418
419419
"""
420420
@spec format_assertion_diff(
421-
%ExUnit.AssertionError{},
421+
ExUnit.AssertionError.t(),
422422
non_neg_integer,
423423
width,
424424
formatter_callback

0 commit comments

Comments
 (0)