-
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce expectGrouped (ExpectGrouping) and group
- Loading branch information
Showing
37 changed files
with
1,129 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...nt/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/grouping.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package ch.tutteli.atrium.api.fluent.en_GB | ||
|
||
import ch.tutteli.atrium.creating.Expect | ||
import ch.tutteli.atrium.creating.ExpectGrouping | ||
import ch.tutteli.atrium.logic.* | ||
import ch.tutteli.atrium.reporting.Text | ||
|
||
/** | ||
* Creates and appends a group based on the given [description] (optionally [representationProvider]) | ||
* and [groupingActions] and returns an [ExpectGrouping]. | ||
* | ||
* @param description The description of the group. | ||
* @param representationProvider Optionally, can be specified if an additional representation shall be reported | ||
* (default is [Text.EMPTY_PROVIDER]) | ||
* @param groupingActions Some action which defines what happens within the group (typically, creating some | ||
* expectations via an expectation-verb such as `expect` or nesting the grouping further). | ||
* | ||
* @return An [ExpectGrouping], allowing to define further subgroups or expectations. | ||
* | ||
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.GroupingSamples.group | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
fun ExpectGrouping.group( | ||
description: String, | ||
representationProvider: () -> Any? = Text.EMPTY_PROVIDER, | ||
groupingActions: ExpectGrouping.() -> Unit | ||
): ExpectGrouping = | ||
_logicAppend { this.grouping(description, representationProvider, groupingActions) } | ||
|
||
/** | ||
* Creates and appends a group based on the given [description] (optionally [representationProvider]) | ||
* and [assertionCreator] and returns an [Expect]. | ||
* | ||
* @param description The description of the group. | ||
* @param representationProvider Optionally, can be specified if an additional representation shall be reported | ||
* (default is [Text.EMPTY_PROVIDER]) | ||
* @param assertionCreator a provider which states the expectations for the current subject belonging to this | ||
* newly created group. | ||
* | ||
* @return an [Expect] for the subject of `this` expectation. | ||
* | ||
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.GroupingSamples.group | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
fun <T> Expect<T>.group( | ||
description: String, | ||
representationProvider: () -> Any? = Text.EMPTY_PROVIDER, | ||
assertionCreator: Expect<T>.() -> Unit | ||
): Expect<T> = _logicAppend { this.group(description, representationProvider, assertionCreator) } |
8 changes: 8 additions & 0 deletions
8
...trium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/GroupingTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package ch.tutteli.atrium.api.fluent.en_GB | ||
|
||
import ch.tutteli.atrium.creating.Expect | ||
import ch.tutteli.atrium.specs.fun3 | ||
|
||
class GroupingTest : ch.tutteli.atrium.specs.integration.GroupingTest( | ||
fun3(Expect<Int>::group) | ||
) |
Oops, something went wrong.