-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: assert_raise example is a compiler warning in Elixir 1.18 #14111
Comments
I had a similar issue in a test that needed to deliberately raise. If an |
@vanderhoop do you want to send a PR that uses a division by zero? |
@josevalim I'm traveling for the holidays at the moment, but I'd be happy to open a quick PR on the 26th if it hasn't been done by then. |
I went ahead as I am doing a new release soon! |
thank you @vanderhoop and @josevalim -- happy holidays! 🎄 |
Elixir and Erlang/OTP versions
Erlang/OTP 27 [erts-15.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]
Elixir 1.18.0 (compiled with Erlang/OTP 27)
Operating system
macOS 15.2
Current behavior
The documentation for
assert_raise
suggests using1 + "test"
to get an Arithmetic Error.https://hexdocs.pm/ex_unit/ExUnit.Assertions.html#assert_raise/2
Expected behavior
While an Arithmetic Error is still the case at runtime, Elixir 1.18 provides a compiler warning for code like this, so maybe it's no longer the best example?
The RuntimeError provided is a better example. Should the
ArithmeticError
example be removed?https://github.com/elixir-lang/elixir/blob/main/lib/ex_unit/lib/ex_unit/assertions.ex#L788
The text was updated successfully, but these errors were encountered: