Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More expectations #31

Closed
wants to merge 4 commits into from
Closed

Conversation

ilyapuchka
Copy link

@ilyapuchka ilyapuchka commented Dec 25, 2017

  • beNotNil to validate that value is not nil
  • notThrow to validate that function does not throw
  • throw(_ match: (Error) -> Bool) to validate that function throws error using custom condition rather than Equatable
  • throw and throw(_:) expectations to better match other APIs (where to is omitted)
  • expect(...).to.not for not expectations, expect(...).to has now better scoped methods and code completion

@kylef
Copy link
Owner

kylef commented Dec 27, 2017

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?

@ilyapuchka
Copy link
Author

ilyapuchka commented Dec 27, 2017

@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?

@kylef kylef self-assigned this Feb 6, 2018
@ilyapuchka ilyapuchka closed this Jun 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants