I think you may need to use assert_raise in that case:
iex> assert_raise KeyError, fn -> map.c end
As far as I can tell a “pure” doctest will always assert on the full exception text (with the caveat that multi-line exceptions are not supported: Handling multi-newline exception messages in doctests? (Elixir v1.12.0))






















