use 'unite' for eunit error formatting#421
use 'unite' for eunit error formatting#421binarytemple wants to merge 1 commit intobenoitc:masterfrom
Conversation
'unite' provides way nicer error output from 'eunit' tests - one thing I found particularly useful when hacking on hackney was the fact that it provides diff'd output on 'assertEqual' assertions whereas the default output formatter truncates the output.
A follow up P/R will patch the unit tests to use assertions rather than equality checks, e.g:
```
[{V, fun() -> ?assertMatch(R,hackney_url:parse_url(V)) end} || {V, R} <- Tests] ++
```
I have an active [P/R](eproxus/unite#10) with eproxus to correct a unhandled case statement - this dependency is to my patched version.
Examples:
```
1) "module 'hackney_integration_tests'"
get_request/0 (/common/hackney/_build/test/lib/hackney/test/hackney_integration_tests.erl:49)
Instantiation failed:
exception error: no match of right hand side value {error,econnrefused} in function hackney_integration_tests:get_request/0 (/common/hackney/_build/test/lib/hackney/test/hackney_integration_tests.erl, line 49)
in call from hackney_integration_tests:all_tests/0 (/common/hackney/_build/test/lib/hackney/test/hackney_integration_tests.erl, line 7) in call from hackney_integration_tests:'-http_requests_test_/0-fun-2-'/1 (/common/hackney/_build/test/lib/hackney/test/hackney_integration_tests.erl, line 38)
151 tests passed 1 fixture cancelled (0.93 s)
===> Error running tests
```
('assertMatch')
```
1) "http://www.example.com/path?key=value#Section%205"
parse_and_unparse_url_test_/0 (/common/hackney/_build/test/lib/hackney/test/hackney_url_tests.erl:140)
Assert match failed!
Expression:
hackney_url:parse_url(V)
Pattern:
R
Actual:
{hackney_url,hackney_tcp,http,<<"www.example.com">>,
<<"/path?key=value#Section%205">>,<<"/path">>,
<<"key=value">>,<<"Section%205">>,"www.example.com",80,
<<>>,<<>>}
```
|
I've updated the example in the P/R - please ignore the example given in the original commit message .... |
|
Thanks for the patch. Is unite available on hex? I would prefer to pass a source package name instead |
|
I don't believe so, and there are P/R outstanding for a year on the project (hence my fork). I'm going to reach out to the author (@eproxus). |
|
Hi everyone, I'm back from vacation now. 😄 I'd be happy to put Unite on hex and upgrade it to Rebar3. For some reason I was not watching my own project, so no notifications... 🤦♂️ |
|
Excellent. Thanks Adam. Great library btw.
…On Mon, 7 Aug 2017, 12:34 Adam Lindberg, ***@***.***> wrote:
Hi everyone, I'm back from vacation now. 😄 I'd be happy to put Unite on
hex and upgrade it to Rebar3. For some reason I was not watching my own
project, so no notifications... 🤦♂️
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#421 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAZk5rHtWivHCdHXuMdWvQFXPaqnW0G4ks5sVvYwgaJpZM4OZ7M1>
.
|
|
Unite is now on Hex.pm: https://hex.pm/packages/unite There's one caveat and that is that the compatibility fixes for pre-18 versions of Erlang are not in yet. I'll work on those next. |
|
@eproxus did you manage to have pre-18 support? |
|
@benoitc Not yet. I'll try to finish it this week. |
|
@benoitc Unite 0.3.0 is now published with hex with backwards compatibility |
|
Nice!
…On Fri, 20 Oct 2017, 18:14 Adam Lindberg, ***@***.***> wrote:
@benoitc <https://github.com/benoitc> Unite 0.3.0 is now published with
hex with backwards compatibility
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#421 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAZk5oAvpXEBOEJ56LYeFW977VqMShCBks5suNTugaJpZM4OZ7M1>
.
|
|
Is this pull request still valid? I find the current |
|
Closing as outdated. The test configuration has changed significantly since 2017. Thank you for the contribution! |
'unite' provides way nicer error output from 'eunit' tests - one thing I found particularly useful when hacking on hackney was the fact that it provides diff'd output on 'assertEqual' assertions whereas the default output formatter truncates the output.
A follow up P/R will patch the unit tests to use assertions rather than equality checks, e.g:
I have an active P/R with eproxus to correct a unhandled case statement - this dependency is to my patched version.
Examples:
('assertMatch')