Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Improved error reporting in ExUnit #265

Closed
josevalim opened this Issue · 9 comments

5 participants

@josevalim
Owner

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
Owner

Don't forget the line numbers too!

@guedes

@rafaelfranca did you start this?

@josevalim
Owner

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

@josevalim
Owner

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
@yrashk

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

@josevalim
Owner
@yrashk
@yrashk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.