Improved error reporting in ExUnit #265

Closed
josevalim opened this Issue Apr 25, 2012 · 9 comments

Projects

None yet

5 participants

@josevalim
Member

We can make the assert macro even smarter than what it is today. For example, the following scenario:

assert List.member?(some_list(), 3 + 5)

When failing, could show the following error message:

Expected true got false
  assert List.member?(some_list(), 3 + 5)
      some_list() #=> [1,2,3]
      3 + 5 #=> 8

By showing the line that failed and breaking apart each argument, we can see exactly why it fails, even if the error message was not good enough.

The first step to implement this feature is the ability to print trees. Since the macro receives a tree, for example { :+, 1, [1,2] }, we need to be able to convert this tree to a string. For example:

Macro.to_binary({ :+, 1, [1,2] }) #=> "1 + 2"
@rafaelfranca

Cool. I can try to implement tomorrow if you want.

@alco
Member
alco commented Apr 26, 2012

Don't forget the line numbers too!

@guedes
guedes commented Sep 4, 2012

@rafaelfranca did you start this?

@josevalim
Member

I don't think he did. What is implemented for sure though is Macro.to_binary.

@josevalim
Member

I am closing this since it is open for some time now. It is still a desired feature and whoever is interested please go ahead!

@josevalim josevalim closed this Jan 28, 2013
@yrashk
yrashk commented Jan 28, 2013

Is it a good idea to close an issue if you want to find somebody interested to do it? 👎

@josevalim
Member

We can always reopen if someone manifests interest. :)

@yrashk
yrashk commented Jan 28, 2013

But how can they find it now?

On Mon, Jan 28, 2013 at 12:26 PM, José Valim notifications@github.comwrote:

We can always reopen if someone manifests interest. :)


Reply to this email directly or view it on GitHubhttps://github.com/elixir-lang/elixir/issues/265#issuecomment-12802509.

@yrashk
yrashk commented Jan 28, 2013

I'd rather introduce a tag... like "Up for grabs"?

On Mon, Jan 28, 2013 at 12:28 PM, Yurii Rashkovskii yrashk@gmail.comwrote:

But how can they find it now?

On Mon, Jan 28, 2013 at 12:26 PM, José Valim notifications@github.comwrote:

We can always reopen if someone manifests interest. :)


Reply to this email directly or view it on GitHubhttps://github.com/elixir-lang/elixir/issues/265#issuecomment-12802509.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment