Closed massivefermion closed 1 year ago
Right now, if we want to test whether a result is Ok and also check the value, this is what we have to do:
Ok
pub fn mock_test() { process() |> should.equal(Ok(correct_result)) }
which is fine, but imagine the following scenario:
pub fn mock_test() { process() |> should.equal(Ok(2 * base_value * { 1 - ratio })) }
With this change, I think we could make it a bit cleaner:
pub fn mock_test() { process() |> should.be_ok |> should.equal(2 * base_value * { 1 - ratio }) }
The same with should.be_error.
should.be_error
There is also the fact that in my experience, people are just not using should.be_ok and should.be_error because they usually need to also check the inner value.
should.be_ok
Mind updating the changelog? Thank you
I updated the changelog, but I wasn't sure about the version, so let me know if you think it should be changed.
Right now, if we want to test whether a result is
Ok
and also check the value, this is what we have to do:which is fine, but imagine the following scenario:
With this change, I think we could make it a bit cleaner:
The same with
should.be_error
.There is also the fact that in my experience, people are just not using
should.be_ok
andshould.be_error
because they usually need to also check the inner value.