hamcrest-rust
hamcrest-rust copied to clipboard
WIP: Potential API change
Hi!
I was trying to play around with this awesome library, and in so doing came up with some (potentially not completely backwards-compatible...) API changes that I think might be worthwhile. Thought I'd throw them together into a PR to get some feedback (prior to updating all the extant Matcher impls to adhere to the new API).
The main thing is to ask Matchers to return the following complete set of information in a structured way:
- What the
Matcherlooks like. - What the
Matcherthinks the "actual" value should look like. - Whether the match was successful or not.
- And optionally an explanation for why the match was unsuccessful.
I also put in a slightly modified template for match-failure panic messages:
Expected: <formatted matcher>
Got: <formatted actual value>
Or, if an optional explanation is attached:
Expected: <formatted matcher>
Got: <formatted actual value> (<explanation>)
DO NOT MERGE. At the moment this is just a vessel for feedback.
Looks cool :+1:
Also, you can prefix PR name with "WIP: " to explicitly state that it's not supposed to be merged. E.g.
WIP: Potential API change
So I guess the question is: should I make a real PR with updated default matchers, etc.?
Ping @ujh
@ujh seems to be MIA? @povilasb What's the path forward?
Hmmm, the only way I see is forking. But I really don't wanna do that. In that case we'd still need @ujh to help publish new versions on crates.io or transfer permissions etc. I'd really like to get some feedback from @ujh first.
@joshburkart you should take a look at https://github.com/Valloric/hamcrest2-rust ;)