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

Adding Path.contains #640

Merged
merged 8 commits into from
Oct 27, 2020
Merged

Adding Path.contains #640

merged 8 commits into from
Oct 27, 2020

Conversation

jgrgt
Copy link
Contributor

@jgrgt jgrgt commented Oct 19, 2020

Current issues:

  • Cannot use contains, causes naming conflicts
  • Not using vararg for now (keeping it simple)
  • Build fails

Should fix #590


I confirm that I have read the Contributor Agreements v1.0, agree to be bound on them and confirm that my contribution is compliant.

@jgrgt jgrgt requested a review from robstoll as a code owner October 19, 2020 18:36
Copy link
Owner

@robstoll robstoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgrgt I don't get the naming conflict. Please try again, address all the review comments respectively. Maybe only the error in infix confused you.

Edit as you can see, you need to rebase your commit on master. Let me know in case you have never done that and the following does not help:
https://github.com/robstoll/atrium/blob/master/.github/CONTRIBUTING.md#git

expect {
expect(folder).containsFun("a", arrayOf("b", "c"))
}.toThrow<AssertionError>().message {
contains("${TO.getDefault()}: ${EXIST.getDefault()}")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here as above.

I would like to see the use case in addition where the 1. and the 3rd. don't exist to be sure that both are reported.

@jgrgt
Copy link
Contributor Author

jgrgt commented Oct 21, 2020

@robstoll Thanks for the thorough review and the many hints. 😄 I pushed with most, if not all, of your remarks processed. The build will fail in ch.tutteli.atrium.api.fluent.en_GB.jdk8.PathAssertionsSpec because the compiler cannot link up the correct contains to fun2. And the logic behind what's happening there is out of my league I'm afraid. That problem was the reason I went for containss...

@robstoll
Copy link
Owner

@jgrgt I'll take a look for the problem. Could you please rebase in the meantime?

@robstoll
Copy link
Owner

@jgrgt you still have the following in the spec:

    fun2(Expect<Path>::containss),

should be contains

@jgrgt
Copy link
Contributor Author

jgrgt commented Oct 22, 2020

@robstoll Rebased, fixed the leftover containss.

@robstoll
Copy link
Owner

robstoll commented Oct 22, 2020

👍 good, now we are almost there, there are three/four things open (I already did some of them):

✔️ 1. Concerning the spec, it seems like we need to help the Kotlin compiler as it is not able to figure out the types by its own (it's basically a bug in the type inference algorithm IMO). rewrite to:

fun2<Path, String, Array<out String>>(Expect<Path>::contains)

✔️ 2. The spec fails, try to fix it (OK, might be hard, so I left a review comment)

  1. please add the test case where the 1st and the 3rd file do not exist and assert that both are in the report

bonus
4. add the test case where the directory as such does not exist

…/tutteli/atrium/api/infix/en_GB/PathAssertionsSpec.kt
…ch/tutteli/atrium/api/fluent/en_GB/PathAssertionsSpec.kt
…-jdk8-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/jdk8/PathAssertionsSpec.kt
@robstoll
Copy link
Owner

@jgrgt Let me know in case you need more information regarding the last open point, point 3 in #640 (comment)

@jgrgt
Copy link
Contributor Author

jgrgt commented Oct 25, 2020

@robstoll Your changes made everything compile, so the hard part is done now. I should be able to finish the other steps next week.

@robstoll
Copy link
Owner

@jgrgt IMO it is good to merge, please remove the WIP prefix of your PR in case you don't intend to do further things.

@jgrgt jgrgt changed the title WIP: Adding Path.contains Adding Path.contains Oct 27, 2020
@robstoll robstoll merged commit 4891a36 into robstoll:master Oct 27, 2020
@robstoll
Copy link
Owner

@jgrgt many thanks for your 2nd contribution to Atrium 🎉

how about a 3rd one?

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.

add Path.hasDirectoryEntry as shortcut for Path.isDirectory + Path.resolve + Path.exists
2 participants