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

Add infix modifier to collections matchers #404

Closed
jensim opened this issue Sep 12, 2018 · 11 comments
Closed

Add infix modifier to collections matchers #404

jensim opened this issue Sep 12, 2018 · 11 comments

Comments

@jensim
Copy link
Contributor

jensim commented Sep 12, 2018

val found = repo.findAll()
found shouldContainExactly listOf("one", "two", "three")
//Before
fun <T, C : Collection<T>> C?.shouldContainExactly(expected: C) = this should containExactly(expected)

//After
infix fun <T, C : Collection<T>> C?.shouldContainExactly(expected: C) = this should containExactly(expected)

This is not applicable to vararg param functions due to limitation in language, but it would look better in for all collections matchers where it is possible.

@sksamuel
Copy link
Member

Yes good idea.

@jensim
Copy link
Contributor Author

jensim commented Sep 12, 2018

I forked master and created a branch with the infix added

@sksamuel
Copy link
Member

Excellent. Please make a PR and I'll merge.

@jensim
Copy link
Contributor Author

jensim commented Sep 12, 2018

#405

@sksamuel
Copy link
Member

I'll include this in 3.1.10

@jensim
Copy link
Contributor Author

jensim commented Sep 12, 2018

@sksamuel When is 3.1.10 due?

@sksamuel
Copy link
Member

I'll try and do it tonight. I need to branch from master and cherry pick a few commits.

@sksamuel
Copy link
Member

3.1.10 is released.

@jensim
Copy link
Contributor Author

jensim commented Sep 13, 2018

@sksamuel
Copy link
Member

sksamuel commented Sep 13, 2018 via email

@jensim
Copy link
Contributor Author

jensim commented Sep 13, 2018

Thanks @sksamuel !

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

No branches or pull requests

2 participants