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 ListFeatureExtractor.last #1654

Closed
12 tasks
robstoll opened this issue Dec 7, 2023 · 5 comments · Fixed by #1664
Closed
12 tasks

add ListFeatureExtractor.last #1654

robstoll opened this issue Dec 7, 2023 · 5 comments · Fixed by #1664
Assignees
Labels
Milestone

Comments

@robstoll
Copy link
Owner

robstoll commented Dec 7, 2023

Platform (all, jvm, js): all
Extension (none, kotlin 1.3): none

Code related feature

val list = listOf(1, 3, 4)
expect(list) {
    last.toEqual(1)
    last {
        toBeGreaterThan(0)
        toBeLessThan(0)
    }
}

//instead of
expect(list) {
    get(list.size - 1).toEqual(1)
    get(List.size -1) {
        toBeGreaterThan(0)
        toBeLessThan(0)
    }
}

Following the things you need to do:

logic

  • extend ListAssertions with a function last (see MapEntryAssertions key as a guideline)
  • implement last in DefaultListAssertions.kt by using the ExpectImpl.feature.extractor... (see get as guideline)

api-fluent

  • provide a val which returns Expect<E> in listFeatureExtractors.kt (see mapEntryFeatureExtractors.kt key as a guideline)
  • provide a fun which expects an assertionCreator-lambda and returns Expect<T> in listFeatureExtractors.kt (see mapEntryFeatureExtractors.kt key as a guideline)
  • extend ListExpectationsSpec in specs -> commonMain (see get... params in this spec) and extend it in atrium-api-fluent -> commonTest
  • add samples to ListFeatureExtractoSamples.kt (see getFeature and get as guideline -- try to provide the reason why an expectation fails)
  • add @since 1.2.0 (adapt to current milestone) to KDOC

api-infix

  • provide a val which returns Expect<E> in listFeatureExtractors.kt (see mapEntryFeatureExtractors.kt key as a guideline)
  • provide a fun which expects an assertionCreator-lambda and returns Expect<T> in listFeatureExtractors.kt (see mapEntryFeatureExtractors.kt key as a guideline)
  • extend ListExpectationsSpec in specs -> commonMain (see get... params in this spec) and extend it in atrium-api-fluent -> commonTest
  • add samples to ListFeatureExtractoSamples.kt (see getFeature and get as guideline -- try to provide the reason why an expectation fails)
  • add @since 1.2.0 (adapt to current milestone) to KDOC
@rakshitriya
Copy link

Hi, can I work on this if this is still open? I am interested.

@constantine-zubrylin
Copy link
Contributor

I feel sorry for that, but can I take it? I've already did some work and would love to finish it: #1664

@robstoll
Copy link
Owner Author

@constantine-zubrilin always good to write here before you start but nice you saw that rakshitriya wrote here 👍

@rakshitriya we find you another issue to work on. take a look at the other good first issues and in case you don't find a suiting one then let me know

@rakshitriya
Copy link

No worries, will check another one!

@constantine-zubrylin
Copy link
Contributor

Pull request closed and merged: #1664

Let's pick a new one.

@robstoll robstoll linked a pull request Jan 25, 2024 that will close this issue
@robstoll robstoll added this to the 1.2.0 milestone Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants