Closed ilyapuchka closed 6 years ago
Adding a not
expectation type was on my list of things to implement for some time. I was thinking of adding a not
"keyword" on an expectation so you could chain not
to various types. I've made a start in #33. What do you think?
@kylef that's nice! Though I find it a bit confusing that things like try expect("kyle").to.to.not.to.to.to.beNil()
are possible. Maybe we can use a phantom type or a separate expectation type to allow only specific methods after to
or not
? Maybe also not.to
or just notTo
would be better than to.not
?
beNotNil
to validate that value is not nilnotThrow
to validate that function does not throwthrow(_ match: (Error) -> Bool)
to validate that function throws error using custom condition rather thanEquatable
throw
andthrow(_:)
expectations to better match other APIs (whereto
is omitted)expect(...).to.not
fornot
expectations,expect(...).to
has now better scoped methods and code completion