Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement capture_io for ex_unit #1059

Merged
merged 1 commit into from
May 15, 2013
Merged

Conversation

mururu
Copy link
Contributor

@mururu mururu commented May 14, 2013

Closes #1035.

@alco
Copy link
Member

alco commented May 14, 2013

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
Copy link
Contributor Author

mururu commented May 15, 2013

Thanks.

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

@josevalim
Copy link
Member

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
Copy link
Contributor Author

mururu commented May 15, 2013

I have pushed the nil change now.

@josevalim
ExUnit.CaptureIO seems to be good idea!

@mururu
Copy link
Contributor Author

mururu commented May 15, 2013

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

:erlang.process_flag(:priority, p)
group_leader_loop(runner, wait, buf)
:stop ->
receive after: (2 -> :ok)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Member

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 josevalim merged commit 44a1404 into elixir-lang:master May 15, 2013
@josevalim
Copy link
Member

❤️ 💚 💙 💛 💜

@mururu mururu deleted the io_protocol branch May 15, 2013 20:26
@alco alco mentioned this pull request May 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

ExUnit should implement the io protocol
4 participants