@@ -32,25 +32,17 @@ defmodule ErrorTrackerTest do
32
32
test "reports badarith errors" do
33
33
string_var = to_string ( 1 )
34
34
35
- # We set the otp_app to `nil` because the error is not reported by an OTP
36
- # application but by this script, so the last line of the stacktrace is not
37
- # the correct one if we leave the right value.
38
- Application . put_env ( :error_tracker , :otp_app , nil )
39
- on_exit ( fn -> Application . put_env ( :error_tracker , :otp_app , :error_tracker ) end )
40
-
41
- % Occurrence { error: error = % Error { } } =
35
+ % Occurrence { error: error = % Error { } , stacktrace: % { lines: [ last_line | _ ] } } =
42
36
report_error ( fn -> 1 + string_var end )
43
37
44
38
assert error . kind == to_string ( ArithmeticError )
45
39
assert error . reason == "bad argument in arithmetic expression"
46
40
47
- # Elixir 1.17.0 reports these errors differently than previous versions
48
- if Version . compare ( System . version ( ) , "1.17.0" ) == :lt do
49
- assert error . source_line =~ @ relative_file_path
50
- else
51
- assert error . source_function == "erlang.+/2"
52
- assert error . source_line == "(nofile)"
53
- end
41
+ assert last_line . module == "erlang"
42
+ assert last_line . function == "+"
43
+ assert last_line . arity == 2
44
+ refute last_line . file
45
+ refute last_line . line
54
46
end
55
47
56
48
test "reports undefined function errors" do
0 commit comments