Debugging with breakpoints in ExUnit
Srikanth Kyatham
Posted on February 28, 2024
Hi
The following is a demonstration on how to debug using debugger. Of course, IO.inspect works. Where it does not.
defmodule Math do
def add(a, b) do
a + b
end
end
defmodule MathTest do
# timeout: :infinity is needed as the exunit timeouts around 3 seconds
@tag timeout: :infinity
test ~c"test add" do
:debugger.start()
:int.ni(Math)
# break_in take module, function, arity
# module - Math
# function - add
# arity - 2 no of parameters
:int.break_in(Math, :add, 2)
end
end
💖 💪 🙅 🚩
Srikanth Kyatham
Posted on February 28, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.