Commit d484d0a 1 parent bb54b0f commit d484d0a Copy full SHA for d484d0a
File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -145,13 +145,44 @@ defmodule Credo.Test.Case do
145
145
146
146
@ doc """
147
147
Asserts the presence of a single issue.
148
+
149
+ This is useful for saying "in this snippet, there is exactly one issue":
150
+
151
+ source_file
152
+ |> run_check(FooBar)
153
+ |> assert_issue()
154
+
155
+ If `callback` is given, calls it with the found issue:
156
+
157
+ source_file
158
+ |> run_check(FooBar)
159
+ |> assert_issue(fn issue ->
160
+ assert issue.line_no == 3
161
+ assert issue.trigger == "foo"
162
+ end)
163
+
148
164
"""
149
165
def assert_issue ( issues , callback \\ nil ) do
150
166
Assertions . assert_issue ( issues , callback )
151
167
end
152
168
153
169
@ doc """
154
170
Asserts the presence of more than one issue.
171
+
172
+ This is useful for saying "in this snippet, there is more than one issue":
173
+
174
+ source_file
175
+ |> run_check(FooBar)
176
+ |> assert_issues()
177
+
178
+ If `callback` is given, calls it with the found issues:
179
+
180
+ source_file
181
+ |> run_check(FooBar)
182
+ |> assert_issues(fn issues ->
183
+ assert Enum.count(issues) == 3
184
+ end)
185
+
155
186
"""
156
187
def assert_issues ( issues , callback \\ nil ) do
157
188
Assertions . assert_issues ( issues , callback )
You can’t perform that action at this time.
0 commit comments