Skip to content

Commit

Permalink
Merge 4de570d into 79460ae
Browse files Browse the repository at this point in the history
  • Loading branch information
robstoll committed Jan 8, 2021
2 parents 79460ae + 4de570d commit a681a49
Show file tree
Hide file tree
Showing 32 changed files with 848 additions and 528 deletions.
4 changes: 2 additions & 2 deletions .github/.codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ coverage:

codecov:
notify:
after_n_builds: 8
after_n_builds: 4
comment:
after_n_builds: 8
after_n_builds: 4
4 changes: 3 additions & 1 deletion .github/workflows/bbc-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
java-version: ${{env.JAVA_VERSION}}

- name: bbcTests
run: ./gradlew bbcTests
env:
BC: 1
run: ./gradlew bbcTests --stacktrace

- name: Upload windows build code coverage
uses: codecov/codecov-action@v1
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/bc-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
java-version: ${{env.JAVA_VERSION}}

- name: bcTests
run: ./gradlew bcTests
env:
BC: 1
run: ./gradlew bcTests --stacktrace

- name: Upload windows build code coverage
uses: codecov/codecov-action@v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package ch.tutteli.atrium.api.fluent.en_GB

import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.impl.StaticName
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.impl.StaticNames
import ch.tutteli.atrium.logic._logic
import ch.tutteli.atrium.logic.creating.charsequence.contains.CharSequenceContains
import ch.tutteli.atrium.logic.creating.charsequence.contains.CharSequenceContains.SearchBehaviour
Expand All @@ -26,7 +26,7 @@ import kotlin.jvm.JvmName
fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.EntryPointStep<T, S>.atLeast(
times: Int
): AtLeastCheckerStep<T, S> =
_logic.atLeastCheckerStep(times, StaticName.containsNotValuesFun) { "${StaticName.atLeast}($it)" }
_logic.atLeastCheckerStep(times, StaticNames.containsNotValuesFun) { "${StaticNames.atLeast}($it)" }

/**
* Restricts a `contains at least` assertion by specifying that the number of occurrences of the value which we
Expand All @@ -47,12 +47,12 @@ fun <T : CharSequence, S : SearchBehaviour> AtLeastCheckerStep<T, S>.butAtMost(
times: Int
): ButAtMostCheckerStep<T, S> = _logic.butAtMostCheckerStep(
times,
StaticName.containsNotValuesFun,
{ l, u -> "${StaticName.atLeast}($l).${StaticName.butAtMost}($u)" },
{ "${StaticName.atLeast}($it)" },
{ "${StaticName.butAtMost}($it)" },
{ "${StaticName.exactly}($it)" },
{ "${StaticName.atMost}($it)" }
StaticNames.containsNotValuesFun,
{ l, u -> "${StaticNames.atLeast}($l).${StaticNames.butAtMost}($u)" },
{ "${StaticNames.atLeast}($it)" },
{ "${StaticNames.butAtMost}($it)" },
{ "${StaticNames.exactly}($it)" },
{ "${StaticNames.atMost}($it)" }
)

/**
Expand All @@ -69,7 +69,7 @@ fun <T : CharSequence, S : SearchBehaviour> AtLeastCheckerStep<T, S>.butAtMost(
fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.EntryPointStep<T, S>.exactly(
times: Int
): ExactlyCheckerStep<T, S> =
_logic.exactlyCheckerStep(times, StaticName.containsNotValuesFun) { "${StaticName.exactly}($it)" }
_logic.exactlyCheckerStep(times, StaticNames.containsNotValuesFun) { "${StaticNames.exactly}($it)" }

/**
* Restricts a `contains` assertion by specifying that the number of occurrences of the value which we
Expand All @@ -91,10 +91,10 @@ fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.EntryPointStep<
times: Int
): AtMostCheckerStep<T, S> = _logic.atMostCheckerStep(
times,
StaticName.containsNotValuesFun,
{ "${StaticName.atMost}($it)" },
{ "${StaticName.atLeast}($it)" },
{ "${StaticName.exactly}($it)" }
StaticNames.containsNotValuesFun,
{ "${StaticNames.atMost}($it)" },
{ "${StaticNames.atLeast}($it)" },
{ "${StaticNames.exactly}($it)" }
)

/**
Expand All @@ -111,4 +111,4 @@ fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.EntryPointStep<
fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.EntryPointStep<T, S>.notOrAtMost(
times: Int
): NotOrAtMostCheckerStep<T, S> =
_logic.notOrAtMostCheckerStep(times, StaticName.containsNotValuesFun) { "${StaticName.notOrAtMost}($it)" }
_logic.notOrAtMostCheckerStep(times, StaticNames.containsNotValuesFun) { "${StaticNames.notOrAtMost}($it)" }
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ch.tutteli.atrium.logic.creating.charsequence.contains.CharSequenceContai
import ch.tutteli.atrium.logic.creating.charsequence.contains.steps.AtLeastCheckerStep
import kotlin.reflect.KFunction3

internal object StaticName {
internal object StaticNames {
val containsNotValuesFun = run {
val f: KFunction3<Expect<CharSequence>, Any, Array<out Any>, Expect<CharSequence>> =
Expect<CharSequence>::containsNot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ch.tutteli.atrium.logic.creating.iterable.contains.searchbehaviours.InAny
import ch.tutteli.atrium.logic.creating.iterable.contains.steps.AtLeastCheckerStep
import kotlin.reflect.KFunction3

internal object StaticName {
internal object StaticNames {
val containsNotValuesFun = run {
val f: KFunction3<Expect<Iterable<Double>>, Double, Array<out Double>, Expect<Iterable<Double>>> =
Expect<Iterable<Double>>::containsNot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package ch.tutteli.atrium.api.fluent.en_GB

import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.impl.StaticName
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.impl.StaticNames
import ch.tutteli.atrium.logic.creating.typeutils.IterableLike
import ch.tutteli.atrium.logic._logic
import ch.tutteli.atrium.logic.creating.iterable.contains.IterableLikeContains
Expand All @@ -27,7 +27,7 @@ import kotlin.jvm.JvmName
fun <E, T: IterableLike, S : InAnyOrderSearchBehaviour> IterableLikeContains.EntryPointStep<E, T, S>.atLeast(
times: Int
): AtLeastCheckerStep<E, T, S> =
_logic.atLeastCheckerStep(times, StaticName.containsNotValuesFun) { "${StaticName.atLeast}($it)" }
_logic.atLeastCheckerStep(times, StaticNames.containsNotValuesFun) { "${StaticNames.atLeast}($it)" }

/**
* Restricts a `contains at least` assertion by specifying that the number of occurrences of the entry which we
Expand All @@ -50,12 +50,12 @@ fun <E, T: IterableLike, S : InAnyOrderSearchBehaviour> AtLeastCheckerStep<E, T,
times: Int
): ButAtMostCheckerStep<E, T, S> = _logic.butAtMostCheckerStep(
times,
StaticName.containsNotValuesFun,
{ l, u -> "${StaticName.atLeast}($l).${StaticName.butAtMost}($u)" },
{ "${StaticName.atLeast}($it)" },
{ "${StaticName.butAtMost}($it)" },
{ "${StaticName.exactly}($it)" },
{ "${StaticName.atMost}($it)" }
StaticNames.containsNotValuesFun,
{ l, u -> "${StaticNames.atLeast}($l).${StaticNames.butAtMost}($u)" },
{ "${StaticNames.atLeast}($it)" },
{ "${StaticNames.butAtMost}($it)" },
{ "${StaticNames.exactly}($it)" },
{ "${StaticNames.atMost}($it)" }
)


Expand All @@ -75,7 +75,7 @@ fun <E, T: IterableLike, S : InAnyOrderSearchBehaviour> AtLeastCheckerStep<E, T,
fun <E, T: IterableLike, S : InAnyOrderSearchBehaviour> IterableLikeContains.EntryPointStep<E, T, S>.exactly(
times: Int
): ExactlyCheckerStep<E, T, S> =
_logic.exactlyCheckerStep(times, StaticName.containsNotValuesFun) { "${StaticName.exactly}($it)" }
_logic.exactlyCheckerStep(times, StaticNames.containsNotValuesFun) { "${StaticNames.exactly}($it)" }

/**
* Restricts a `contains` assertion by specifying that the number of occurrences of the entry which we
Expand All @@ -99,10 +99,10 @@ fun <E, T: IterableLike, S : InAnyOrderSearchBehaviour> IterableLikeContains.Ent
times: Int
): AtMostCheckerStep<E, T, S> = _logic.atMostCheckerStep(
times,
StaticName.containsNotValuesFun,
{ "${StaticName.atMost}($it)" },
{ "${StaticName.atLeast}($it)" },
{ "${StaticName.exactly}($it)" }
StaticNames.containsNotValuesFun,
{ "${StaticNames.atMost}($it)" },
{ "${StaticNames.atLeast}($it)" },
{ "${StaticNames.exactly}($it)" }
)

/**
Expand All @@ -121,4 +121,4 @@ fun <E, T: IterableLike, S : InAnyOrderSearchBehaviour> IterableLikeContains.Ent
fun <E, T: IterableLike, S : InAnyOrderSearchBehaviour> IterableLikeContains.EntryPointStep<E, T, S>.notOrAtMost(
times: Int
): NotOrAtMostCheckerStep<E, T, S> =
_logic.notOrAtMostCheckerStep(times, StaticName.containsNotValuesFun) { "${StaticName.notOrAtMost}($it)" }
_logic.notOrAtMostCheckerStep(times, StaticNames.containsNotValuesFun) { "${StaticNames.notOrAtMost}($it)" }
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package ch.tutteli.atrium.api.fluent.en_GB

import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.impl.StaticName
import ch.tutteli.atrium.creating.Expect
import ch.tutteli.atrium.logic.creating.charsequence.contains.CharSequenceContains
import ch.tutteli.atrium.logic.creating.charsequence.contains.searchbehaviours.IgnoringCaseSearchBehaviour
import ch.tutteli.atrium.logic.creating.charsequence.contains.searchbehaviours.NoOpSearchBehaviour
import ch.tutteli.atrium.logic.creating.iterable.contains.IterableLikeContains
import ch.tutteli.atrium.logic.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
import ch.tutteli.atrium.logic.creating.iterable.contains.steps.AtLeastCheckerStep
import ch.tutteli.atrium.specs.fun2
import ch.tutteli.atrium.specs.name
import ch.tutteli.atrium.specs.notImplemented
Expand All @@ -17,11 +19,11 @@ abstract class CharSequenceContainsSpecBase {
private val containsNotProp: KProperty<*> = Expect<String>::containsNot
protected val containsNot = containsNotProp.name
protected val containsRegex = fun2<String, String, Array<out String>>(Expect<String>::containsRegex).name
protected val atLeast = StaticName.atLeast
protected val butAtMost = StaticName.butAtMost
protected val exactly = StaticName.exactly
protected val atMost = StaticName.atMost
protected val notOrAtMost = StaticName.notOrAtMost
protected val atLeast = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::atLeast.name
protected val butAtMost = AtLeastCheckerStep<*, *, InAnyOrderSearchBehaviour>::butAtMost.name
protected val atMost = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::atMost.name
protected val exactly = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::exactly.name
protected val notOrAtMost = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::notOrAtMost.name
private val regexKFun: KFunction3<
CharSequenceContains.CheckerStep<*, NoOpSearchBehaviour>,
String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package ch.tutteli.atrium.api.infix.en_GB

import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.impl.StaticName
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.impl.StaticNames
import ch.tutteli.atrium.logic._logic
import ch.tutteli.atrium.logic.creating.charsequence.contains.CharSequenceContains
import ch.tutteli.atrium.logic.creating.charsequence.contains.CharSequenceContains.SearchBehaviour
Expand All @@ -26,7 +26,7 @@ import kotlin.jvm.JvmName
infix fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.EntryPointStep<T, S>.atLeast(
times: Int
): AtLeastCheckerStep<T, S> =
_logic.atLeastCheckerStep(times, StaticName.containsNotValuesFun) { "`${StaticName.atLeast} $it`" }
_logic.atLeastCheckerStep(times, StaticNames.containsNotValuesFun) { "`${StaticNames.atLeast} $it`" }

/**
* Restricts a `contains at least` assertion by specifying that the number of occurrences of the value which we
Expand All @@ -47,12 +47,12 @@ infix fun <T : CharSequence, S : SearchBehaviour> AtLeastCheckerStep<T, S>.butAt
times: Int
): ButAtMostCheckerStep<T, S> = _logic.butAtMostCheckerStep(
times,
StaticName.containsNotValuesFun,
{ l, u -> "`${StaticName.atLeast} $l ${StaticName.butAtMost} $u`" },
{ "`${StaticName.atLeast} $it`" },
{ "`${StaticName.butAtMost} $it`" },
{ "`${StaticName.exactly} $it`" },
{ "`${StaticName.atMost} $it`" }
StaticNames.containsNotValuesFun,
{ l, u -> "`${StaticNames.atLeast} $l ${StaticNames.butAtMost} $u`" },
{ "`${StaticNames.atLeast} $it`" },
{ "`${StaticNames.butAtMost} $it`" },
{ "`${StaticNames.exactly} $it`" },
{ "`${StaticNames.atMost} $it`" }
)

/**
Expand All @@ -69,7 +69,7 @@ infix fun <T : CharSequence, S : SearchBehaviour> AtLeastCheckerStep<T, S>.butAt
infix fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.EntryPointStep<T, S>.exactly(
times: Int
): ExactlyCheckerStep<T, S> =
_logic.exactlyCheckerStep(times, StaticName.containsNotValuesFun) { "`${StaticName.exactly} $it`" }
_logic.exactlyCheckerStep(times, StaticNames.containsNotValuesFun) { "`${StaticNames.exactly} $it`" }

/**
* Restricts a `contains` assertion by specifying that the number of occurrences of the value which we
Expand All @@ -91,10 +91,10 @@ infix fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.EntryPoin
times: Int
): AtMostCheckerStep<T, S> = _logic.atMostCheckerStep(
times,
StaticName.containsNotValuesFun,
{ "`${StaticName.atMost} $it`" },
{ "`${StaticName.atLeast} $it`" },
{ "`${StaticName.exactly} $it`" }
StaticNames.containsNotValuesFun,
{ "`${StaticNames.atMost} $it`" },
{ "`${StaticNames.atLeast} $it`" },
{ "`${StaticNames.exactly} $it`" }
)

/**
Expand All @@ -111,4 +111,4 @@ infix fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.EntryPoin
infix fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.EntryPointStep<T, S>.notOrAtMost(
times: Int
): NotOrAtMostCheckerStep<T, S> =
_logic.notOrAtMostCheckerStep(times, StaticName.containsNotValuesFun) { "`${StaticName.notOrAtMost} $it`" }
_logic.notOrAtMostCheckerStep(times, StaticNames.containsNotValuesFun) { "`${StaticNames.notOrAtMost} $it`" }
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import ch.tutteli.atrium.logic.creating.charsequence.contains.CharSequenceContai
import ch.tutteli.atrium.logic.creating.charsequence.contains.steps.AtLeastCheckerStep
import kotlin.reflect.KFunction2

internal object StaticName {
val containsNotValuesFun: String = run {
internal object StaticNames {
val containsNotValuesFun = run {
val f: KFunction2<Expect<CharSequence>, Values<Any>, Expect<CharSequence>> =
Expect<CharSequence>::containsNot
//TODO use once https://youtrack.jetbrains.com/issue/KT-38013 is fixed (there are other places where "values" is hard-coded)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ch.tutteli.atrium.logic.creating.iterable.contains.steps.AtLeastCheckerSt
import ch.tutteli.atrium.logic.creating.iterable.contains.steps.NotCheckerStep
import kotlin.reflect.KFunction2

internal object StaticName {
internal object StaticNames {
val containsNotValuesFun = run {
val containsNotKf: KFunction2<Expect<Iterable<Double>>, o, NotCheckerStep<Double, Iterable<Double>, NotSearchBehaviour>> =
Expect<Iterable<Double>>::containsNot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.tutteli.atrium.api.infix.en_GB

import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.impl.StaticName
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.impl.StaticNames
import ch.tutteli.atrium.logic.creating.typeutils.IterableLike
import ch.tutteli.atrium.logic._logic
import ch.tutteli.atrium.logic.creating.iterable.contains.IterableLikeContains
Expand All @@ -23,7 +23,7 @@ import ch.tutteli.atrium.logic.creating.iterable.contains.steps.*
infix fun <E, T : IterableLike, S : InAnyOrderSearchBehaviour> IterableLikeContains.EntryPointStep<E, T, S>.atLeast(
times: Int
): AtLeastCheckerStep<E, T, S> =
_logic.atLeastCheckerStep(times, StaticName.containsNotValuesFun) { "`${StaticName.atLeast} $it`" }
_logic.atLeastCheckerStep(times, StaticNames.containsNotValuesFun) { "`${StaticNames.atLeast} $it`" }

/**
* Restricts a `contains at least` assertion by specifying that the number of occurrences of the entry which we
Expand All @@ -46,12 +46,12 @@ infix fun <E, T : IterableLike, S : InAnyOrderSearchBehaviour> AtLeastCheckerSte
times: Int
): ButAtMostCheckerStep<E, T, S> = _logic.butAtMostCheckerStep(
times,
StaticName.containsNotValuesFun,
{ l, u -> "`${StaticName.atLeast} $l ${StaticName.butAtMost} $u`" },
{ "`${StaticName.atLeast} $it`" },
{ "`${StaticName.butAtMost} $it`" },
{ "`${StaticName.exactly} $it`" },
{ "`${StaticName.atMost} $it`" }
StaticNames.containsNotValuesFun,
{ l, u -> "`${StaticNames.atLeast} $l ${StaticNames.butAtMost} $u`" },
{ "`${StaticNames.atLeast} $it`" },
{ "`${StaticNames.butAtMost} $it`" },
{ "`${StaticNames.exactly} $it`" },
{ "`${StaticNames.atMost} $it`" }
)

/**
Expand All @@ -70,7 +70,7 @@ infix fun <E, T : IterableLike, S : InAnyOrderSearchBehaviour> AtLeastCheckerSte
infix fun <E, T : IterableLike, S : InAnyOrderSearchBehaviour> IterableLikeContains.EntryPointStep<E, T, S>.exactly(
times: Int
): ExactlyCheckerStep<E, T, S> =
_logic.exactlyCheckerStep(times, StaticName.containsNotValuesFun) { "`${StaticName.exactly} $it`" }
_logic.exactlyCheckerStep(times, StaticNames.containsNotValuesFun) { "`${StaticNames.exactly} $it`" }

/**
* Restricts a `contains` assertion by specifying that the number of occurrences of the entry which we
Expand All @@ -94,10 +94,10 @@ infix fun <E, T : IterableLike, S : InAnyOrderSearchBehaviour> IterableLikeConta
times: Int
): AtMostCheckerStep<E, T, S> = _logic.atMostCheckerStep(
times,
StaticName.containsNotValuesFun,
{ "`${StaticName.atMost} $it`" },
{ "`${StaticName.atLeast} $it`" },
{ "`${StaticName.exactly} $it`" }
StaticNames.containsNotValuesFun,
{ "`${StaticNames.atMost} $it`" },
{ "`${StaticNames.atLeast} $it`" },
{ "`${StaticNames.exactly} $it`" }
)

/**
Expand All @@ -116,4 +116,4 @@ infix fun <E, T : IterableLike, S : InAnyOrderSearchBehaviour> IterableLikeConta
infix fun <E, T : IterableLike, S : InAnyOrderSearchBehaviour> IterableLikeContains.EntryPointStep<E, T, S>.notOrAtMost(
times: Int
): NotOrAtMostCheckerStep<E, T, S> =
_logic.notOrAtMostCheckerStep(times, StaticName.containsNotValuesFun) { "`${StaticName.notOrAtMost} $it`" }
_logic.notOrAtMostCheckerStep(times, StaticNames.containsNotValuesFun) { "`${StaticNames.notOrAtMost} $it`" }
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ch.tutteli.atrium.api.infix.en_GB

import ch.tutteli.atrium.api.infix.en_GB.creating.All
import ch.tutteli.atrium.api.infix.en_GB.creating.KeyWithCreator
import ch.tutteli.atrium.api.infix.en_GB.creating.Pairs
import ch.tutteli.atrium.api.infix.en_GB.creating.map.KeyValues
Expand Down Expand Up @@ -135,6 +136,17 @@ inline infix fun <K, reified V : Any, T : Map<out K, V?>> Expect<T>.contains(
allKeyValues: KeyValues<K, V>
): Expect<T> = it contains o inAny order the keyValues(allKeyValues.expected, *allKeyValues.otherExpected)

//TODO 0.16.0 check if we really go with `to contain` since `to` caused troubles in the past
@Deprecated(
"Use `to contain keyValues` instead; will be removed with 1.0.0",
ReplaceWith(
"this toContain keyValues(all.expected, *all.otherExpected)",
"ch.tutteli.atrium.api.infix.en_GB.keyValues"
)
)
inline infix fun <K, reified V : Any, T : Map<out K, V?>> Expect<T>.contains(
all: All<KeyWithValueCreator<K, V>>
): Expect<T> = it contains keyValues(all.expected, *all.otherExpected)

/**
* Expects that the subject of the assertion (a [Map]) contains only (in any order) for each [KeyWithValueCreator]
Expand Down
Loading

0 comments on commit a681a49

Please sign in to comment.