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

Update try! interface, port forward to 2018 edition #4

Open
wants to merge 5 commits into
base: master
from

Conversation

Projects
None yet
1 participant
@antifuchs
Copy link
Owner

antifuchs commented Jan 2, 2019

This PR updates credibility to the 2018 edition and adjusts to allow inclusion in Result-returning test functions, to allow use of ? in more places.

More detailed list:

  • Remove use of failure crate, mandate that Err results only be Sized + Debug
  • Make the test block runner compatible with Result-returning test functions - unless a test block returns a Result, the underlying test function does not have to return a Result either; that also means that you can't use ? to early-return from a test block unless the function returns a Result, but that seems reasonable.
  • Document the new state of the world & introduce a few test cases.

antifuchs added some commits Dec 13, 2018

Get rid of failure crate, try to deal with Result<_, _> more nicely
Test blocks should not have to return a Result type (and neither
should they have to return Result<_, failure::Error>, that is kinda
gross too). Instead, let's implement a test block result that can be
converted from regular Results, and ().
Improve the interface some more
This makes TestBlockResult into an, effectively, implementation
detail, that translates a Result or () into a real Result.
Remove the weird workarounds and support Result-returning test funs
I hadn't realized that rust supports Results as return values from
test functions; or maybe it didn't when I first wrote this; anyway,
this is what's supported now.

With this change, we support returning more than a single kind of
Result (as long as they all convert into the result that the test
function returns) from the test block, which relied on type inference
before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment