Skip to content
This repository was archived by the owner on Aug 12, 2021. It is now read-only.

Improve output when #[test] returns an Err(_) value #9

Merged
merged 1 commit into from
Mar 19, 2019
Merged

Improve output when #[test] returns an Err(_) value #9

merged 1 commit into from
Mar 19, 2019

Conversation

LukasKalbertodt
Copy link
Member

Output before:

---- foo stdout ----
Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
thread 'foo' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `0`: the test returned a termination value with a non-zero status code (1) which indicates a failure', src/libtest/lib.rs:335:5

Output with this commit:

---- foo stdout ----
Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
thread 'foo' panicked at 'the test returned a termination value with a non-zero status code (1) which indicates a failure (this most likely means your test returned an `Err(_)`)', src/libtest/lib.rs:336:9

It's still by no means perfect. But it's already way better since
there is no strange left/right 0/1 output (I regularly got confused
by that output and searched for a failing assert_eq in my code)


(This PR was initially opened here, but while it was open, libtest was moved out of the compiler repo.)

Output before:

    ---- foo stdout ----
    Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
    thread 'foo' panicked at 'assertion failed: `(left == right)`
      left: `1`,
     right: `0`: the test returned a termination value with a non-zero status code (1) which indicates a failure', src/libtest/lib.rs:335:5

Output with this commit:

    ---- foo stdout ----
    Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
    thread 'foo' panicked at 'the test returned a termination value with a non-zero status code (1) which indicates a failure (this most likely means your test returned an `Err(_)`)', src/libtest/lib.rs:336:9

It's still by no means perfect. But it's already way better since
there is no strange left/right 0/1 output (I regularly got confused
by that output and searched for a failing `assert_eq` in my code)
Copy link
Contributor

@gnzlbg gnzlbg left a comment

Choose a reason for hiding this comment

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

LGTM. Ping me when CI is green and I'll merge.

@LukasKalbertodt
Copy link
Member Author

@gnzlbg Great! And: ping already ;-) Another great thing about moving out of the main repo: CI doesn't take hours.

@gnzlbg gnzlbg merged commit e2a4b62 into rust-lang:master Mar 19, 2019
@gnzlbg
Copy link
Contributor

gnzlbg commented Mar 19, 2019

Yeah

@gnzlbg
Copy link
Contributor

gnzlbg commented Mar 19, 2019

Thank you!

@LukasKalbertodt LukasKalbertodt deleted the improve-output-when-err-test branch March 19, 2019 23:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants