-
-
Notifications
You must be signed in to change notification settings - Fork 226
Closed
Description
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 MapEntryAssertionskey
as a guideline) - implement last in DefaultListAssertions.kt by using the
ExpectImpl.feature.extractor...
(seeget
as guideline)
api-fluent
- provide a val which returns
Expect<E>
in listFeatureExtractors.kt (see mapEntryFeatureExtractors.ktkey
as a guideline) - provide a fun which expects an
assertionCreator
-lambda and returnsExpect<T>
in listFeatureExtractors.kt (see mapEntryFeatureExtractors.ktkey
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.ktkey
as a guideline) - provide a fun which expects an
assertionCreator
-lambda and returnsExpect<T>
in listFeatureExtractors.kt (see mapEntryFeatureExtractors.ktkey
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