elixir-lang / elixir

Elixir is a dynamic, functional language for building scalable and maintainable applications
https://elixir-lang.org/
Apache License 2.0
24.55k stars 3.38k forks source link

Assert raise reverses expected and actual #694

Closed orenbenkiki closed 11 years ago

orenbenkiki commented 11 years ago

Line 240 reads:

assert error.message == message

It should read:

assert message == error.message

(The expected value should be on the left).

yrashk commented 11 years ago
  def assert_raise(exception, message, function) when is_binary(message) and is_function(function) do
    error = assert_raise(exception, function)
    assert error.message == message
    error
  end

and

iex(1)> import ExUnit.Assertions
[]
iex(2)> assert 1 == 2
** (ExUnit.AssertionError) Expected 1 to be equal to (==) 2

As far as I can tell from the above report, it expects the expected value on the right.

josevalim commented 11 years ago

The problem is that it is not clear which one you passed as argument by reading just the error message. I am working on it.