-
-
Notifications
You must be signed in to change notification settings - Fork 211
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 samples for pathExpectations of api-infix (#999) #1003
Add samples for pathExpectations of api-infix (#999) #1003
Conversation
...um-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/pathExpectations.kt
Outdated
Show resolved
Hide resolved
...n_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PathExpectationSamples.kt
Outdated
Show resolved
Hide resolved
...n_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PathExpectationSamples.kt
Outdated
Show resolved
Hide resolved
...n_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PathExpectationSamples.kt
Outdated
Show resolved
Hide resolved
...n_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PathExpectationSamples.kt
Outdated
Show resolved
Hide resolved
...n_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PathExpectationSamples.kt
Outdated
Show resolved
Hide resolved
...n_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PathExpectationSamples.kt
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## main #1003 +/- ##
=======================================
Coverage 90.86% 90.86%
=======================================
Files 433 433
Lines 4359 4359
Branches 219 219
=======================================
Hits 3961 3961
Misses 349 349
Partials 49 49
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Hi @robstoll, I have updated PR with your review comments. Please have a look |
expect(dir) resolve "test_file.ttt" toEqual fileInDir toEndWith Paths.get("ttt") | ||
// | not reported `toEqual(fileInDir)` already fails | ||
// | fails because resolve returns *test_file.ttt and fileInDir equals *test_file.txt | ||
// | use `resolve other { ... }` if you want that all expectations are evaluated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(dir) resolve "test_file.ttt" toEqual fileInDir toEndWith Paths.get("ttt") | |
// | not reported `toEqual(fileInDir)` already fails | |
// | fails because resolve returns *test_file.ttt and fileInDir equals *test_file.txt | |
// | use `resolve other { ... }` if you want that all expectations are evaluated | |
expect(dir) resolve "test_file.ttt" toEqual fileInDir toEndWith Paths.get("ttt") | |
// | | | not reported `toEqual(fileInDir)` already fails | |
// | | fails because resolve returns *test_file.ttt and fileInDir equals *test_file.txt | |
// | use `resolve other { ... }` if you want that all expectations are evaluated |
@rhushikesh Thanks for the adjustments. I suggested one small improvement for the comments. |
Hi @robstoll, I have updated PR with your review comments. Also I have added samples for pathAssertions. Please have a look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ratkayandras we are nearly there, some small adjustments and we can merge
...rium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/pathAssertions.kt
Show resolved
Hide resolved
val dir = tempDir.newDirectory("test.$extension") | ||
|
||
|
||
expect(dir) extension { // subject is now of type String (actually "txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more precise would be (I know you copied it from api-fluent, should be improved there as well)
expect(dir) extension { // subject is now of type String (actually "txt") | |
expect(dir) extension { // subject inside this block is of type String (actually "txt") |
} | ||
|
||
fails { | ||
expect(dir) extension { // subject is now of type String (actually "txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(dir) extension { // subject is now of type String (actually "txt") | |
expect(dir) extension { // subject inside this block is of type String (actually "txt") |
expect(dir).extension toEqual "txtt" toEndWith "jpg" | ||
// | subject is now of type String (actually "txt") | ||
// | | fails because it doesn't equal to "txtt" | ||
// | | not reported | ||
// | use `.extension` if you want that all expectations are evaluated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you style it the same way you did it further below in fileNameFeature
expect(dir).extension toEqual "txtt" toEndWith "jpg" | |
// | subject is now of type String (actually "txt") | |
// | | fails because it doesn't equal to "txtt" | |
// | | not reported | |
// | use `.extension` if you want that all expectations are evaluated | |
expect(dir).extension toEqual "txtt" toEndWith "jpg" | |
// | | | not reported | |
// | | fails because it doesn't equal to "txtt" | |
// | subject is now of type String (actually "txt") | |
// | use ` extension { ... }` if you want that all expectations are evaluated |
Note the change for extension { ... }
Not your fault, it's actually also wrong in api-fluent. If you don't mind, would be great, if you could fix it there as well => use .extension { ... }
there.
fun fileName() { | ||
val dir = tempDir.newDirectory("test_dir") | ||
|
||
expect(dir) fileName { // subject is now of type String (actually "test_dir") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(dir) fileName { // subject is now of type String (actually "test_dir") | |
expect(dir) fileName { // subject inside this block is of type String (actually "test_dir") |
same error in api-fluent
fun fileNameWithoutExtension() { | ||
val dir = tempDir.newDirectory("test_dir") | ||
|
||
expect(dir) fileNameWithoutExtension { // subject is now of type String (actually "test_dir") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(dir) fileNameWithoutExtension { // subject is now of type String (actually "test_dir") | |
expect(dir) fileNameWithoutExtension { // subject inside this block is of type String (actually "test_dir") |
same same api-fluent
} | ||
|
||
fails { // because fileNameWithoutExtension equals `test_dir` | ||
expect(dir) fileNameWithoutExtension { // subject is now of type String (actually "test_dir") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(dir) fileNameWithoutExtension { // subject is now of type String (actually "test_dir") | |
expect(dir) fileNameWithoutExtension { // subject inside this block is of type String (actually "test_dir") |
it toEqual dir3 // fails because dir3 and dir does not have same parents | ||
it notToBe existing // still evaluated even though `toEqual(dir3)` already fails | ||
// use `.parent` if you want a fail fast behaviour |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it toEqual dir3 // fails because dir3 and dir does not have same parents | |
it notToBe existing // still evaluated even though `toEqual(dir3)` already fails | |
// use `.parent` if you want a fail fast behaviour | |
it toEqual dir3 // fails because dir3 and dir does not have same parents | |
it notToBe existing // still evaluated even though `toEqual(dir3)` already fails | |
// use `.parent` if you want a fail fast behaviour |
expect(dir) resolve "test_file.ttt" toEqual fileInDir toEndWith Paths.get("ttt") | ||
// | | | not reported `toEqual(fileInDir)` already fails | ||
// | | fails because resolve returns *test_file.ttt and fileInDir equals *test_file.txt | ||
// | use `resolve other { ... }` if you want that all expectations are evaluated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// | use `resolve other { ... }` if you want that all expectations are evaluated | |
// | use `resolve path(other) { ... }` if you want that all expectations are evaluated |
expect(dir) resolve path("test_file.txt") { | ||
it toEqual fileInDir // fails | ||
it toBe existing // still evaluated even though `toEqual(fileInDir)` already fails | ||
// use `.resolve(other).` if you want a fail fast behaviour |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// use `.resolve(other).` if you want a fail fast behaviour | |
// use `resolve other` if you want a fail fast behaviour |
...n_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PathExpectationSamples.kt
Outdated
Show resolved
Hide resolved
…/tutteli/atrium/api/infix/en_GB/samples/PathExpectationSamples.kt
@rhushikesh thanks for your 3 contribution to Atrium, you're on 🔥 I am going to fix the remaining things myself. I won't have time to look at 1004 tonight but will do tomorrow |
PR for this issue
I confirm that I have read the Contributor Agreements v1.0, agree to be bound on them and confirm that my contribution is compliant.