-
Notifications
You must be signed in to change notification settings - Fork 21
Conversation
I've also added you as a collaborator :) |
src/output.rs
Outdated
if !got.contains(&self.expect) { | ||
bail!(ErrorKind::OutputMismatch( | ||
self.kind.to_string(), | ||
vec!["Foo".to_string()], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Placeholder for now. I think we can use error_chain to add the usual "Assert CLI command {cmd} failed:" prefix at the call site.
src/lib.rs
Outdated
}, | ||
_ => {}, | ||
if let Some(ouput_assertion) = self.expect_stdout { | ||
ouput_assertion.execute(&output)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Do error-chain magic here, cf. #24 (comment))
LGTM
|
Is there an ETA on this? I'm in a bit of a pickle. I have a new test for my project blocked on needing a new feature in assert_cli (current_dir). Unfortunately, even if I contribute it and it gets released quickly, I can't upgrade because of #31 which is currently blocked on this PR. |
@epage sorry, this project hasn't been very actively lately. …and I have totally forgotten to get this PR landed or even what its state was or if I had some more ideas I wanted to try. Can you give this branch a try? If it works for you I can merge it right now. And if you were to send a PR to implement #31 you could have a new release quite soon :) |
I looked over the code. I think the changes are reasonable and look tested. Of course there is room for improvement
I do not think any of these ideas should hold up this PR. |
Alright, thanks! I'll merge this and we can iterate on this in future PRs! |
38: Reuse output assertions between stdout/stderr r=killercup a=epage Reusing output assertions makes it easier to add new ones in the future. I feel the new naming scheme this provides makes intent of the API clearer as well (`stdout().contains` vs `prints`). This is done by creating an `OutputAssertionBuilder` that `Assertion` delegates to for creating output assertions, passing in an enum of which stream to read from. This unfortunately meant dropping the cool type tricks that were introduced in #24. This also required merging the storage of stdout/stderr assertions. To accommodate this, output assertions are now appended which might be useful on its own.
This refactors the output assertions to use a generic type, unit structs, and a new traits. Basically, type system shenanigans!
Previous discussions:
To be answered
enum Precision { Exact, Fuzzy }
?