hamcrest-rust icon indicating copy to clipboard operation
hamcrest-rust copied to clipboard

WIP: Potential API change

Open joshburkart opened this issue 7 years ago • 6 comments
trafficstars

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:

  1. What the Matcher looks like.
  2. What the Matcher thinks the "actual" value should look like.
  3. Whether the match was successful or not.
    1. 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.

joshburkart avatar Mar 19 '18 01:03 joshburkart

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

povilasb avatar Mar 20 '18 18:03 povilasb

So I guess the question is: should I make a real PR with updated default matchers, etc.?

joshburkart avatar Mar 20 '18 20:03 joshburkart

Ping @ujh

povilasb avatar Mar 22 '18 05:03 povilasb

@ujh seems to be MIA? @povilasb What's the path forward?

joshburkart avatar Apr 08 '18 17:04 joshburkart

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.

povilasb avatar Apr 26 '18 11:04 povilasb

@joshburkart you should take a look at https://github.com/Valloric/hamcrest2-rust ;)

povilasb avatar Oct 03 '18 04:10 povilasb