Skip to content

Commit

Permalink
Merge pull request #1454 from robstoll/use-kotlin-1.8-but-api/languag…
Browse files Browse the repository at this point in the history
…e-1.4

use kotlin 1.8.21 but api/languageLevel 1.4
  • Loading branch information
robstoll authored Jun 1, 2023
2 parents 19ab6ee + d0e45f4 commit c2030ad
Show file tree
Hide file tree
Showing 92 changed files with 1,191 additions and 357 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ internal object StaticNames {
f.name
}

val atLeast = CharSequenceContains.EntryPointStep<*, *>::atLeast.name
val butAtMost = AtLeastCheckerStep<*, *>::butAtMost.name
val atMost = CharSequenceContains.EntryPointStep<*, *>::atMost.name
val exactly = CharSequenceContains.EntryPointStep<*, *>::exactly.name
val notOrAtMost = CharSequenceContains.EntryPointStep<*, *>::notOrAtMost.name
val atLeast = CharSequenceContains.EntryPointStep<CharSequence, *>::atLeast.name
val butAtMost = AtLeastCheckerStep<CharSequence, *>::butAtMost.name
val atMost = CharSequenceContains.EntryPointStep<CharSequence, *>::atMost.name
val exactly = CharSequenceContains.EntryPointStep<CharSequence, *>::exactly.name
val notOrAtMost = CharSequenceContains.EntryPointStep<CharSequence, *>::notOrAtMost.name
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import kotlin.reflect.*

class MetaFeatureOption<T>(expect: Expect<T>) {

@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalComponentFactoryContainer::class)
@OptIn(ExperimentalComponentFactoryContainer::class)
private val methodCallFormatter = expect._logic.components.build<MethodCallFormatter>()

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ch.tutteli.atrium.creating.Expect
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.logic.creating.typeutils.IterableLike
import kotlin.reflect.KFunction3

internal object StaticNames {
Expand All @@ -15,11 +16,11 @@ internal object StaticNames {
f.name
}

val atLeast = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::atLeast.name
val butAtMost = AtLeastCheckerStep<*, *, InAnyOrderSearchBehaviour>::butAtMost.name
val atMost = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::atMost.name
val exactly = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::exactly.name
val notOrAtMost = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::notOrAtMost.name
val atLeast = IterableLikeContains.EntryPointStep<Any?, IterableLike, InAnyOrderSearchBehaviour>::atLeast.name
val butAtMost = AtLeastCheckerStep<Any?, IterableLike, InAnyOrderSearchBehaviour>::butAtMost.name
val atMost = IterableLikeContains.EntryPointStep<Any?, IterableLike, InAnyOrderSearchBehaviour>::atMost.name
val exactly = IterableLikeContains.EntryPointStep<Any?, IterableLike, InAnyOrderSearchBehaviour>::exactly.name
val notOrAtMost = IterableLikeContains.EntryPointStep<Any?, IterableLike, InAnyOrderSearchBehaviour>::notOrAtMost.name

/** @since 1.0.0 */
val notToHaveElementsOrNone = Expect<List<Int>>::notToHaveElementsOrNone.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ch.tutteli.atrium.logic.creating.RootExpectOptions
import ch.tutteli.atrium.reporting.Text

@Suppress("DEPRECATION" /* RequiresOptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@Experimental
@RequiresOptIn
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.FUNCTION)
annotation class ExperimentalWithOptions
Expand All @@ -21,7 +21,7 @@ annotation class ExperimentalWithOptions
* In case the subject of `this` expectation is not defined (i.e. `_logic.maybeSubject` is [None]),
* then the previous representation is used.
*
* @return An new [Expect] with the specified options for subject of `this` expectation.
* @return A new [Expect] with the specified options for subject of `this` expectation.
*/
@ExperimentalWithOptions
fun <T> RootExpect<T>.withRepresentation(textRepresentation: String): Expect<T> =
Expand All @@ -40,7 +40,7 @@ fun <T> RootExpect<T>.withRepresentation(textRepresentation: String): Expect<T>
* In case the subject of `this` expectation is not defined (i.e. `_logic.maybeSubject` is [None]),
* then the previous representation is used.
*
* @return An new [Expect] with the specified options for subject of `this` expectation.
* @return A new [Expect] with the specified options for subject of `this` expectation.
*/
@ExperimentalWithOptions
fun <T> RootExpect<T>.withRepresentation(representationProvider: (T) -> Any): Expect<T> =
Expand All @@ -50,22 +50,20 @@ fun <T> RootExpect<T>.withRepresentation(representationProvider: (T) -> Any): Ex
* Uses the given [configuration]-lambda to create an [RootExpectOptions] which in turn is used
* to re-define (parts) of the existing configuration.
*
* @return An new [Expect] with the specified options for subject of `this` expectation.
* @return A new [Expect] with the specified options for subject of `this` expectation.
*/
@ExperimentalWithOptions
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalNewExpectTypes::class)
@OptIn(ExperimentalNewExpectTypes::class)
fun <T> RootExpect<T>.withOptions(configuration: RootExpectBuilder.OptionsChooser<T>.() -> Unit): Expect<T> =
withOptions(RootExpectOptions(configuration))

/**
* Uses the given [options] to override (parts) of the existing configuration.
*
* @return An new [Expect] with the specified options for subject of `this` expectation.
* @return A new [Expect] with the specified options for subject of `this` expectation.
*/
@ExperimentalWithOptions
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalNewExpectTypes::class)
@OptIn(ExperimentalNewExpectTypes::class)
fun <T> RootExpect<T>.withOptions(options: RootExpectOptions<T>): Expect<T> =
RootExpect(this, options)

Expand All @@ -76,11 +74,10 @@ fun <T> RootExpect<T>.withOptions(options: RootExpectOptions<T>): Expect<T> =
* In case the subject of `this` expectation is not defined (i.e. `_logic.maybeSubject` is [None]),
* then the previous representation is used.
*
* @return An new [Expect] with the specified options for subject of `this` expectation.
* @return A new [Expect] with the specified options for subject of `this` expectation.
*/
@ExperimentalWithOptions
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalNewExpectTypes::class)
@OptIn(ExperimentalNewExpectTypes::class)
fun <T, R> FeatureExpect<T, R>.withRepresentation(textRepresentation: String): Expect<R> =
withOptions { withRepresentation(textRepresentation) }

Expand All @@ -97,33 +94,30 @@ fun <T, R> FeatureExpect<T, R>.withRepresentation(textRepresentation: String): E
* In case the subject of `this` expectation is not defined (i.e. `_logic.maybeSubject` is [None]),
* then the previous representation is used.
*
* @return An new [Expect] with the specified options for subject of `this` expectation.
* @return A new [Expect] with the specified options for subject of `this` expectation.
*/
@ExperimentalWithOptions
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalNewExpectTypes::class)
@OptIn(ExperimentalNewExpectTypes::class)
fun <T, R> FeatureExpect<T, R>.withRepresentation(representationProvider: (R) -> Any): Expect<R> =
withOptions { withRepresentation(representationProvider) }

/**
* Uses the given [configuration]-lambda to create a [FeatureExpectOptions] which in turn is used
* to re-define (parts) of the existing configuration.
*
* @return An new [Expect] with the specified options for subject of `this` expectation.
* @return A new [Expect] with the specified options for subject of `this` expectation.
*/
@ExperimentalWithOptions
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalNewExpectTypes::class)
@OptIn(ExperimentalNewExpectTypes::class)
fun <T, R> FeatureExpect<T, R>.withOptions(configuration: FeatureExpectOptionsChooser<R>.() -> Unit): Expect<R> =
withOptions(FeatureExpectOptionsChooser(configuration))

/**
* Uses the given [options] to override (parts) of the existing configuration.
*
* @return An new [Expect] with the specified options for subject of `this` expectation.
* @return A new [Expect] with the specified options for subject of `this` expectation.
*/
@ExperimentalWithOptions
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalNewExpectTypes::class, ExperimentalComponentFactoryContainer::class)
@OptIn(ExperimentalNewExpectTypes::class, ExperimentalComponentFactoryContainer::class)
fun <T, R> FeatureExpect<T, R>.withOptions(options: FeatureExpectOptions<R>): Expect<R> =
FeatureExpect(this, options)
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ fun <T, R> Expect<T>.its(extractor: T.() -> R): FeatureExpect<T, R> =
fun <T, R> Expect<T>.its(extractor: T.() -> R, assertionCreator: Expect<R>.() -> Unit): Expect<T> =
itsInternal(extractor).collectAndAppend(assertionCreator)

@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalComponentFactoryContainer::class, ExperimentalFeatureInfo::class)
@OptIn(ExperimentalComponentFactoryContainer::class, ExperimentalFeatureInfo::class)
private fun <R, T> Expect<T>.itsInternal(extractor: T.() -> R) =
_logic.manualFeature(_logic.components.build<FeatureInfo>().determine(extractor, stacksToDrop = 2), extractor)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ abstract class CharSequenceToContainSpecBase {
private val notToContainProp: KProperty<*> = Expect<String>::notToContain
protected val toContainNot = notToContainProp.name
protected val toContainRegex = fun2<String, String, Array<out String>>(Expect<String>::toContainRegex).name
protected val atLeast = CharSequenceContains.EntryPointStep<*, *>::atLeast.name
protected val butAtMost = AtLeastCheckerStep<*, *>::butAtMost.name
protected val atMost = CharSequenceContains.EntryPointStep<*, *>::atMost.name
protected val exactly = CharSequenceContains.EntryPointStep<*, *>::exactly.name
protected val notOrAtMost = CharSequenceContains.EntryPointStep<*, *>::notOrAtMost.name
protected val atLeast = CharSequenceContains.EntryPointStep<CharSequence, *>::atLeast.name
protected val butAtMost = AtLeastCheckerStep<CharSequence, *>::butAtMost.name
protected val atMost = CharSequenceContains.EntryPointStep<CharSequence, *>::atMost.name
protected val exactly = CharSequenceContains.EntryPointStep<CharSequence, *>::exactly.name
protected val notOrAtMost = CharSequenceContains.EntryPointStep<CharSequence, *>::notOrAtMost.name
private val regexKFun: KFunction3<
CharSequenceContains.CheckerStep<*, NoOpSearchBehaviour>,
CharSequenceContains.CheckerStep<CharSequence, NoOpSearchBehaviour>,
String,
Array<out String>,
Expect<*>
> = CharSequenceContains.CheckerStep<*, NoOpSearchBehaviour>::regex
> = CharSequenceContains.CheckerStep<CharSequence, NoOpSearchBehaviour>::regex
protected val regex = regexKFun.name
protected val ignoringCase = CharSequenceContains.EntryPointStep<*, NoOpSearchBehaviour>::ignoringCase.name
protected val value = CharSequenceContains.CheckerStep<*, NoOpSearchBehaviour>::value.name
protected val values = CharSequenceContains.CheckerStep<*, NoOpSearchBehaviour>::values.name
protected val ignoringCase = CharSequenceContains.EntryPointStep<CharSequence, NoOpSearchBehaviour>::ignoringCase.name
protected val value = CharSequenceContains.CheckerStep<CharSequence, NoOpSearchBehaviour>::value.name
protected val values = CharSequenceContains.CheckerStep<CharSequence, NoOpSearchBehaviour>::values.name
protected val elementsOf = CharSequenceContains.EntryPointStep<String, IgnoringCaseSearchBehaviour>::elementsOf.name

@Suppress("unused", "UNUSED_VALUE")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ abstract class IterableToContainSpecBase {
protected val value = IterableLikeContains.EntryPointStep<Int, List<Int>, InOrderOnlySearchBehaviour>::value.name
protected val values = IterableLikeContains.EntryPointStep<Int, List<Int>, InOrderOnlySearchBehaviour>::values.name
protected val entry = IterableLikeContains.EntryPointStep<Int, List<Int>, InOrderOnlySearchBehaviour>::entry.name
protected val entries = IterableLikeContains.EntryPointStep<*, *, InOrderOnlySearchBehaviour>::entries.name
protected val entries = IterableLikeContains.EntryPointStep<Any, Iterable<*>, InOrderOnlySearchBehaviour>::entries.name
protected val elementsOf =
IterableLikeContains.EntryPointStep<Int, Iterable<Int>, InOrderOnlySearchBehaviour>::elementsOf.name

//@formatter:off
protected val atLeast = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::atLeast.name
protected val butAtMost = AtLeastCheckerStep<*, *, InAnyOrderSearchBehaviour>::butAtMost.name
protected val exactly = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::exactly.name
protected val atMost = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::atMost.name
protected val notOrAtMost = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::notOrAtMost.name
protected val atLeast = IterableLikeContains.EntryPointStep<Any, Iterable<*>, InAnyOrderSearchBehaviour>::atLeast.name
protected val butAtMost = AtLeastCheckerStep<Any, Iterable<*>, InAnyOrderSearchBehaviour>::butAtMost.name
protected val exactly = IterableLikeContains.EntryPointStep<Any, Iterable<*>, InAnyOrderSearchBehaviour>::exactly.name
protected val atMost = IterableLikeContains.EntryPointStep<Any, Iterable<*>, InAnyOrderSearchBehaviour>::atMost.name
protected val notOrAtMost = IterableLikeContains.EntryPointStep<Any, Iterable<*>, InAnyOrderSearchBehaviour>::notOrAtMost.name
protected val inAnyOrder = IterableLikeContains.EntryPointStep<Int, List<Int>, NoOpSearchBehaviour>::inAnyOrder.name
protected val inOrder = IterableLikeContains.EntryPointStep<Int, List<Int>, NoOpSearchBehaviour>::inOrder.name
protected val only = IterableLikeContains.EntryPointStep<Int, List<Int>, InAnyOrderSearchBehaviour>::only.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class MapFeatureExtractorSamples {
fun values() {
expect(mapOf(1 to "a"))
.values { // subject inside this expectation-group is of type Collection<String> (containing "a")
toEqual(setOf("a"))
toContain("a")
}

fails {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ internal object StaticNames {
"`${f.name} values`"
}

val atLeast = CharSequenceContains.EntryPointStep<*, *>::atLeast.name
val butAtMost = AtLeastCheckerStep<*, *>::butAtMost.name
val atMost = CharSequenceContains.EntryPointStep<*, *>::atMost.name
val exactly = CharSequenceContains.EntryPointStep<*, *>::exactly.name
val notOrAtMost = CharSequenceContains.EntryPointStep<*, *>::notOrAtMost.name
val atLeast = CharSequenceContains.EntryPointStep<CharSequence, *>::atLeast.name
val butAtMost = AtLeastCheckerStep<CharSequence, *>::butAtMost.name
val atMost = CharSequenceContains.EntryPointStep<CharSequence, *>::atMost.name
val exactly = CharSequenceContains.EntryPointStep<CharSequence, *>::exactly.name
val notOrAtMost = CharSequenceContains.EntryPointStep<CharSequence, *>::notOrAtMost.name
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import kotlin.reflect.KProperty1
*
* @since 0.12.0
*/
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalComponentFactoryContainer::class)
@OptIn(ExperimentalComponentFactoryContainer::class)
data class Feature<T, R> internal constructor(
val descriptionProvider: (ComponentFactoryContainer) -> String,
val extractor: (T) -> R
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import kotlin.reflect.KProperty1
*
* @since 0.12.0
*/
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalComponentFactoryContainer::class)
@OptIn(ExperimentalComponentFactoryContainer::class)
data class FeatureWithCreator<T, R> internal constructor(
val descriptionProvider: (ComponentFactoryContainer) -> String,
val extractor: (T) -> R,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import kotlin.reflect.*

class MetaFeatureOption<T>(expect: Expect<T>) {

@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalComponentFactoryContainer::class)
@OptIn(ExperimentalComponentFactoryContainer::class)
private val methodCallFormatter = expect._logic.components.build<MethodCallFormatter>()

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ch.tutteli.atrium.logic.creating.iterable.contains.searchbehaviours.InAny
import ch.tutteli.atrium.logic.creating.iterable.contains.searchbehaviours.NotSearchBehaviour
import ch.tutteli.atrium.logic.creating.iterable.contains.steps.AtLeastCheckerStep
import ch.tutteli.atrium.logic.creating.iterable.contains.steps.NotCheckerStep
import ch.tutteli.atrium.logic.creating.typeutils.IterableLike
import kotlin.reflect.KFunction2

internal object StaticNames {
Expand All @@ -19,11 +20,11 @@ internal object StaticNames {
"`${containsNotKf.name} values`"
}

val atLeast = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::atLeast.name
val butAtMost = AtLeastCheckerStep<*, *, InAnyOrderSearchBehaviour>::butAtMost.name
val atMost = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::atMost.name
val exactly = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::exactly.name
val notOrAtMost = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::notOrAtMost.name
val atLeast = IterableLikeContains.EntryPointStep<Any?, IterableLike, InAnyOrderSearchBehaviour>::atLeast.name
val butAtMost = AtLeastCheckerStep<Any?, IterableLike, InAnyOrderSearchBehaviour>::butAtMost.name
val atMost = IterableLikeContains.EntryPointStep<Any?, IterableLike, InAnyOrderSearchBehaviour>::atMost.name
val exactly = IterableLikeContains.EntryPointStep<Any?, IterableLike, InAnyOrderSearchBehaviour>::exactly.name
val notOrAtMost = IterableLikeContains.EntryPointStep<Any?, IterableLike, InAnyOrderSearchBehaviour>::notOrAtMost.name

/** @since 1.0.0 */
val notToHaveElementsOrNone = Expect<List<Int>>::notToHaveElementsOrNone.name
Expand Down
Loading

0 comments on commit c2030ad

Please sign in to comment.