Implement capture_io for ex_unit by mururu · Pull Request #1059 · elixir-lang/elixir

@mururu

@alco

Looks nice.

  1. Why assertions.ex? I think it should go to a separate file.
  2. Is it possible to distinguish between no IO and IO.write ""? E.g. return nil if nothing at all has been printed.

@mururu

Thanks.

  1. Now, I agree with you. How about ExUnit.Helpers?
  2. It is possible. nil is seems to good idea.

@josevalim

I would create ExUnit.CaptureIO with just one public function. :) People could import it whenever they need the functionality. 👍 for returning nil too. :)

Thanks @mururu, this is an awesome job!

@mururu

I have pushed the nil change now.

@josevalim
ExUnit.CaptureIO seems to be good idea!

@mururu

Updated the commit.
Now, we have only ExUnit.CaptureIO.capture_io/1 and it returns nil if nothing should been printed.

yrashk

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the reason for 2?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this line is not need. I'll remove it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what is worth, I think none of the io implementations in otp use a gen server (not the file ones and not the one in eunit)

josevalim pushed a commit that referenced this pull request

May 15, 2013
Implement capture_io for ex_unit

@josevalim

@alco alco mentioned this pull request

May 17, 2013