Skip to content

Commit 6868af0

Browse files
author
José Valim
committed
Do not rely on ops code stacktraces, closes #6352
1 parent fd8a129 commit 6868af0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/elixir/test/elixir/kernel/quote_test.exs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,14 @@ end
195195

196196
# DO NOT MOVE THIS LINE
197197
defmodule Kernel.QuoteTest.Errors do
198-
defmacro defadd do
198+
defmacro defraise do
199199
quote location: :keep do
200-
def add(a, b), do: a + b
200+
def will_raise(_a, _b), do: raise "oops"
201201
end
202202
end
203203

204204
defmacro will_raise do
205-
quote location: :keep, do: raise "omg"
205+
quote location: :keep, do: raise "oops"
206206
end
207207
end
208208

@@ -211,16 +211,16 @@ defmodule Kernel.QuoteTest.ErrorsTest do
211211
import Kernel.QuoteTest.Errors
212212

213213
# Defines the add function
214-
defadd()
214+
defraise()
215215

216216
test "inside function error" do
217-
assert_raise ArithmeticError, fn ->
218-
add(:a, :b)
217+
assert_raise RuntimeError, fn ->
218+
will_raise(:a, :b)
219219
end
220220

221221
mod = Kernel.QuoteTest.ErrorsTest
222222
file = __ENV__.file |> Path.relative_to_cwd |> String.to_charlist
223-
assert [{^mod, :add, 2, [file: ^file, line: 200]} | _] = System.stacktrace
223+
assert [{^mod, :will_raise, 2, [file: ^file, line: 200]} | _] = System.stacktrace
224224
end
225225

226226
test "outside function error" do

0 commit comments

Comments
 (0)