index
Helper function to create an IndexWithCreator based on the given index and assertionCreator.
Samples
val list = listOf(1, 2, 3)
expect(list) get index(0) { // subject inside this expectation-group is of type Int (actually 1)
it toBeLessThan 2
it toBeGreaterThan 0
}
expect(list) get index(1) { // subject inside this expectation-group is of type Int (actually 2)
it toBeLessThan 3
it toBeGreaterThan 1
}
fails {
// all expectations are evaluated inside an expectation-group block; for more details:
// https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group
expect(list) get index(0) {
it toBeGreaterThan 2 // fails
it toBeLessThan 0 // still evaluated even though `isGreaterThan(2)` already fails,
// use `get index` if you want a fail fast behaviour
}
}