From 36f8438a2b8eaaa71634cd8404f43f7d4cfb7106 Mon Sep 17 00:00:00 2001 From: Maxim Ivanov Date: Tue, 17 Nov 2020 14:27:06 +0100 Subject: [PATCH] #178: added support for assertSoftly --- .../org/amshove/kluent/AssertionErrors.kt | 47 ++++++++ .../main/kotlin/org/amshove/kluent/Basic.kt | 1 - .../kotlin/org/amshove/kluent/Collections.kt | 1 - .../org/amshove/kluent/ErrorCollector.kt | 104 ++++++++++++++++++ .../main/kotlin/org/amshove/kluent/Softly.kt | 20 ++++ .../kotlin/org/amshove/kluent/StackTraces.kt | 37 +++++++ .../org/amshove/kluent/internal/Assertions.kt | 34 ++++-- .../org/amshove/kluent/internal/Utility.kt | 4 + .../org/amshove/kluent/InternalAssertions.kt | 10 +- .../amshove/kluent/{ => tests}/DataClasses.kt | 2 +- .../{ => tests}/basic/ShouldBeDigitShould.kt | 2 +- .../{ => tests}/basic/ShouldBeFalseShould.kt | 9 +- .../{ => tests}/basic/ShouldBeNullShould.kt | 2 +- .../{ => tests}/basic/ShouldBeShould.kt | 4 +- .../{ => tests}/basic/ShouldBeTrueShould.kt | 10 +- .../{ => tests}/basic/ShouldEqualShould.kt | 4 +- .../basic/ShouldNotBeDigitShould.kt | 2 +- .../basic/ShouldNotBeFalseShould.kt | 2 +- .../basic/ShouldNotBeNullShould.kt | 2 +- .../{ => tests}/basic/ShouldNotBeShould.kt | 4 +- .../basic/ShouldNotBeTrueShould.kt | 2 +- .../{ => tests}/basic/ShouldNotEqualShould.kt | 4 +- .../kluent/{ => tests}/basic/ShouldShould.kt | 4 +- .../charsequence/ShouldBeBlankShould.kt | 2 +- .../charsequence/ShouldBeEmptyShould.kt | 2 +- .../charsequence/ShouldBeNullOrBlankShould.kt | 2 +- .../charsequence/ShouldBeNullOrEmptyShould.kt | 2 +- .../charsequence/ShouldContainAllShould.kt | 2 +- .../charsequence/ShouldContainNoneShould.kt | 2 +- .../charsequence/ShouldContainShould.kt | 2 +- .../charsequence/ShouldContainSomeShould.kt | 2 +- .../charsequence/ShouldEndWithShould.kt | 2 +- .../charsequence/ShouldMatchShould.kt | 2 +- .../charsequence/ShouldNotBeBlankShould.kt | 2 +- .../charsequence/ShouldNotBeEmptyShould.kt | 2 +- .../ShouldNotBeNullOrBlankShould.kt | 2 +- .../ShouldNotBeNullOrEmptyShould.kt | 2 +- .../charsequence/ShouldNotContainAllShould.kt | 2 +- .../charsequence/ShouldNotContainShould.kt | 2 +- .../charsequence/ShouldNotEndWithShould.kt | 2 +- .../charsequence/ShouldNotMatchShould.kt | 2 +- .../charsequence/ShouldNotStartWithShould.kt | 2 +- .../charsequence/ShouldStartWithShould.kt | 2 +- .../collections/ShouldBeEmptyShould.kt | 2 +- .../collections/ShouldBeInRangeShould.kt | 2 +- .../collections/ShouldBeInShould.kt | 4 +- .../ShouldBeSortedAccordingToShould.kt | 4 +- .../collections/ShouldContainAllShould.kt | 2 +- .../collections/ShouldContainAnyShould.kt | 2 +- .../collections/ShouldContainFalseShould.kt | 2 +- .../collections/ShouldContainNoneShould.kt | 2 +- .../collections/ShouldContainSameShould.kt | 2 +- .../collections/ShouldContainShould.kt | 4 +- .../ShouldContainSingleItemShould.kt | 2 +- .../collections/ShouldContainSomeShould.kt | 2 +- .../collections/ShouldContainTrueShould.kt | 2 +- .../collections/ShouldEqualShould.kt | 4 +- .../collections/ShouldEqualUnorderedShould.kt | 6 +- .../collections/ShouldHaveKeyShould.kt | 4 +- .../collections/ShouldHaveSingleItemShould.kt | 2 +- .../collections/ShouldHaveSizeShould.kt | 2 +- .../collections/ShouldHaveValueShould.kt | 4 +- .../collections/ShouldMatchPredicateShould.kt | 4 +- .../collections/ShouldNotBeEmptyShould.kt | 2 +- .../collections/ShouldNotBeInRangeShould.kt | 2 +- .../collections/ShouldNotBeInShould.kt | 4 +- .../collections/ShouldNotContainAnyShould.kt | 2 +- .../collections/ShouldNotContainShould.kt | 4 +- .../collections/ShouldNotEqualShould.kt | 5 +- .../ShouldNotEqualUnorderedShould.kt | 4 +- .../collections/ShouldNotHaveKeyShould.kt | 4 +- .../collections/ShouldNotHaveValueShould.kt | 4 +- .../concepts/ChainingAssertionsShould.kt | 2 +- .../ShouldBeGreaterOrEqualToShould.kt | 2 +- .../numerical/ShouldBeGreaterThanShould.kt | 2 +- .../numerical/ShouldBeInRangeShould.kt | 2 +- .../numerical/ShouldBeLessOrEqualToShould.kt | 2 +- .../numerical/ShouldBeLessThanShould.kt | 2 +- .../numerical/ShouldBeNearShould.kt | 2 +- .../numerical/ShouldBeNegativeShould.kt | 2 +- .../numerical/ShouldBePositiveShould.kt | 2 +- .../ShouldNotBeGreaterOrEqualToShould.kt | 2 +- .../numerical/ShouldNotBeGreaterThanShould.kt | 2 +- .../numerical/ShouldNotBeInRangeShould.kt | 2 +- .../ShouldNotBeLessOrEqualToShould.kt | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../org/amshove/kluent/ErrorCollector.kt | 5 + .../kotlin/org/amshove/kluent/StackTraces.kt | 3 + .../kotlin/org/amshove/kluent/Equivalency.kt | 2 +- .../amshove/kluent/UserStackTraceConverter.kt | 42 +++++++ .../org/amshove/kluent/errorCollector.kt | 50 +++++++++ .../kotlin/org/amshove/kluent/stacktraces.kt | 26 +++++ .../tests/assertions/softly/AssertSoftly.kt | 85 ++++++++++++++ .../tests/collections/BackticksShould.kt | 2 +- .../org/amshove/kluent/ErrorCollector.kt | 5 + .../kotlin/org/amshove/kluent/StackTraces.kt | 3 + 96 files changed, 577 insertions(+), 114 deletions(-) create mode 100644 common/src/main/kotlin/org/amshove/kluent/AssertionErrors.kt create mode 100644 common/src/main/kotlin/org/amshove/kluent/ErrorCollector.kt create mode 100644 common/src/main/kotlin/org/amshove/kluent/Softly.kt create mode 100644 common/src/main/kotlin/org/amshove/kluent/StackTraces.kt rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/DataClasses.kt (64%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/basic/ShouldBeDigitShould.kt (96%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/basic/ShouldBeFalseShould.kt (65%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/basic/ShouldBeNullShould.kt (93%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/basic/ShouldBeShould.kt (87%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/basic/ShouldBeTrueShould.kt (61%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/basic/ShouldEqualShould.kt (93%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/basic/ShouldNotBeDigitShould.kt (96%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/basic/ShouldNotBeFalseShould.kt (88%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/basic/ShouldNotBeNullShould.kt (94%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/basic/ShouldNotBeShould.kt (87%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/basic/ShouldNotBeTrueShould.kt (88%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/basic/ShouldNotEqualShould.kt (93%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/basic/ShouldShould.kt (96%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldBeBlankShould.kt (87%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldBeEmptyShould.kt (87%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldBeNullOrBlankShould.kt (91%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldBeNullOrEmptyShould.kt (91%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldContainAllShould.kt (92%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldContainNoneShould.kt (94%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldContainShould.kt (92%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldContainSomeShould.kt (94%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldEndWithShould.kt (89%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldMatchShould.kt (93%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldNotBeBlankShould.kt (88%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldNotBeEmptyShould.kt (88%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldNotBeNullOrBlankShould.kt (94%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldNotBeNullOrEmptyShould.kt (94%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldNotContainAllShould.kt (92%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldNotContainShould.kt (93%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldNotEndWithShould.kt (89%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldNotMatchShould.kt (93%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldNotStartWithShould.kt (90%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/charsequence/ShouldStartWithShould.kt (89%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldBeEmptyShould.kt (98%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldBeInRangeShould.kt (92%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldBeInShould.kt (97%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldBeSortedAccordingToShould.kt (98%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldContainAllShould.kt (99%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldContainAnyShould.kt (98%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldContainFalseShould.kt (91%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldContainNoneShould.kt (99%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldContainSameShould.kt (99%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldContainShould.kt (98%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldContainSingleItemShould.kt (97%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldContainSomeShould.kt (99%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldContainTrueShould.kt (91%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldEqualShould.kt (98%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldEqualUnorderedShould.kt (78%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldHaveKeyShould.kt (92%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldHaveSingleItemShould.kt (98%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldHaveSizeShould.kt (96%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldHaveValueShould.kt (92%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldMatchPredicateShould.kt (96%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldNotBeEmptyShould.kt (98%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldNotBeInRangeShould.kt (92%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldNotBeInShould.kt (97%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldNotContainAnyShould.kt (99%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldNotContainShould.kt (98%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldNotEqualShould.kt (97%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldNotEqualUnorderedShould.kt (89%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldNotHaveKeyShould.kt (92%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/collections/ShouldNotHaveValueShould.kt (92%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/concepts/ChainingAssertionsShould.kt (96%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/numerical/ShouldBeGreaterOrEqualToShould.kt (96%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/numerical/ShouldBeGreaterThanShould.kt (96%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/numerical/ShouldBeInRangeShould.kt (98%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/numerical/ShouldBeLessOrEqualToShould.kt (96%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/numerical/ShouldBeLessThanShould.kt (94%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/numerical/ShouldBeNearShould.kt (98%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/numerical/ShouldBeNegativeShould.kt (96%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/numerical/ShouldBePositiveShould.kt (96%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/numerical/ShouldNotBeGreaterOrEqualToShould.kt (96%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/numerical/ShouldNotBeGreaterThanShould.kt (96%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/numerical/ShouldNotBeInRangeShould.kt (98%) rename common/src/test/kotlin/org/amshove/kluent/{ => tests}/numerical/ShouldNotBeLessOrEqualToShould.kt (96%) create mode 100644 js/src/main/kotlin/org/amshove/kluent/ErrorCollector.kt create mode 100644 js/src/main/kotlin/org/amshove/kluent/StackTraces.kt create mode 100644 jvm/src/main/kotlin/org/amshove/kluent/UserStackTraceConverter.kt create mode 100644 jvm/src/main/kotlin/org/amshove/kluent/errorCollector.kt create mode 100644 jvm/src/main/kotlin/org/amshove/kluent/stacktraces.kt create mode 100644 jvm/src/test/kotlin/org/amshove/kluent/tests/assertions/softly/AssertSoftly.kt create mode 100644 native/src/main/kotlin/org/amshove/kluent/ErrorCollector.kt create mode 100644 native/src/main/kotlin/org/amshove/kluent/StackTraces.kt diff --git a/common/src/main/kotlin/org/amshove/kluent/AssertionErrors.kt b/common/src/main/kotlin/org/amshove/kluent/AssertionErrors.kt new file mode 100644 index 00000000..3b120e2c --- /dev/null +++ b/common/src/main/kotlin/org/amshove/kluent/AssertionErrors.kt @@ -0,0 +1,47 @@ +package org.amshove.kluent + +import kotlin.test.assertFails + +/** An error that bundles multiple other [Throwable]s together */ +class MultiAssertionError(errors: List) : AssertionError(createMessage(errors)) { + companion object { + private fun createMessage(errors: List) = buildString { + append("\nThe following ") + + if (errors.size == 1) { + append("assertion") + } else { + append(errors.size).append(" assertions") + } + append(" failed:\n") + + if (errors.size == 1) { + append(errors[0].message).append("\n") + stacktraces.throwableLocation(errors[0])?.let { + append("\tat ").append(it).append("\n") + } + } else { + for ((i, err) in errors.withIndex()) { + append(i + 1).append(") ").append(err.message).append("\n") + stacktraces.throwableLocation(err)?.let { + append("\tat ").append(it).append("\n") + } + } + } + } + } +} + +fun assertionError(error: Throwable): Throwable { + val message = buildString { + append("\nThe following assertion failed:\n") + + append(error.message).append("\n") + stacktraces.throwableLocation(error)?.let { + append("\tat ").append(it).append("\n") + } + } + val t = AssertionError(message) + stacktraces.cleanStackTrace(t) + return t +} diff --git a/common/src/main/kotlin/org/amshove/kluent/Basic.kt b/common/src/main/kotlin/org/amshove/kluent/Basic.kt index e884cd13..29c342e7 100644 --- a/common/src/main/kotlin/org/amshove/kluent/Basic.kt +++ b/common/src/main/kotlin/org/amshove/kluent/Basic.kt @@ -5,7 +5,6 @@ import kotlin.contracts.ExperimentalContracts import kotlin.contracts.contract import kotlin.test.assertEquals import kotlin.test.assertNotEquals -import kotlin.test.fail @Deprecated("Use `shouldBeEqualTo`", ReplaceWith("this.shouldBeEqualTo(expected)")) infix fun T.shouldEqual(expected: T?): T = this.shouldBeEqualTo(expected) diff --git a/common/src/main/kotlin/org/amshove/kluent/Collections.kt b/common/src/main/kotlin/org/amshove/kluent/Collections.kt index 24a3f3b1..5201476c 100644 --- a/common/src/main/kotlin/org/amshove/kluent/Collections.kt +++ b/common/src/main/kotlin/org/amshove/kluent/Collections.kt @@ -3,7 +3,6 @@ package org.amshove.kluent import org.amshove.kluent.internal.* import kotlin.test.assertEquals import kotlin.test.assertNotEquals -import kotlin.test.fail infix fun Array.shouldContain(expected: T) = apply { if (this.contains(expected)) Unit else failExpectedActual("Array doesn't contain \"$expected\"", "the Array to contain \"$expected\"", join(this)) } diff --git a/common/src/main/kotlin/org/amshove/kluent/ErrorCollector.kt b/common/src/main/kotlin/org/amshove/kluent/ErrorCollector.kt new file mode 100644 index 00000000..6b5c5fd6 --- /dev/null +++ b/common/src/main/kotlin/org/amshove/kluent/ErrorCollector.kt @@ -0,0 +1,104 @@ +package org.amshove.kluent + +expect val errorCollector: ErrorCollector + +enum class ErrorCollectionMode { + Soft, Hard +} + +typealias Clue = () -> String + +interface ErrorCollector { + + fun getCollectionMode(): ErrorCollectionMode + + fun setCollectionMode(mode: ErrorCollectionMode) + + /** + * Returns the errors accumulated in the current context. + */ + fun errors(): List + + /** + * Adds the given error to the current context. + */ + fun pushError(t: Throwable) + + /** + * Clears all errors from the current context. + */ + fun clear() + + fun pushClue(clue: Clue) + + fun popClue() + + /** + * Returns the current clue context. + * That is all the clues nested to this point. + */ + fun clueContext(): List +} + +open class BasicErrorCollector : ErrorCollector { + + private val failures = mutableListOf() + private var mode = ErrorCollectionMode.Hard + private val clues = mutableListOf() + + override fun getCollectionMode(): ErrorCollectionMode = mode + + override fun setCollectionMode(mode: ErrorCollectionMode) { + this.mode = mode + } + + override fun pushClue(clue: Clue) { + clues.add(0, clue) + } + + override fun popClue() { + clues.removeAt(0) + } + + override fun clueContext(): List = clues.toList() + + override fun pushError(t: Throwable) { + failures.add(t) + } + + override fun errors(): List = failures.toList() + + override fun clear() = failures.clear() +} + +fun clueContextAsString() = errorCollector.clueContext().let { + if (it.isEmpty()) "" else it.joinToString("\n", postfix = "\n") { f -> f.invoke() } +} + +/** + * If we are in "soft assertion mode" will add this throwable to the + * list of throwables for the current execution. Otherwise will + * throw immediately. + */ +fun ErrorCollector.collectOrThrow(error: Throwable) { + when (getCollectionMode()) { + ErrorCollectionMode.Soft -> pushError(error) + ErrorCollectionMode.Hard -> throw error + } +} + +/** + * The errors for the current execution are thrown as a single + * throwable. + */ +fun ErrorCollector.throwCollectedErrors() { + // set the collection mode back to the default + setCollectionMode(ErrorCollectionMode.Hard) + val failures = errors() + clear() + if (failures.isNotEmpty()) { + val t = MultiAssertionError(failures) + stacktraces.cleanStackTrace(t) + throw t + } +} \ No newline at end of file diff --git a/common/src/main/kotlin/org/amshove/kluent/Softly.kt b/common/src/main/kotlin/org/amshove/kluent/Softly.kt new file mode 100644 index 00000000..d279a781 --- /dev/null +++ b/common/src/main/kotlin/org/amshove/kluent/Softly.kt @@ -0,0 +1,20 @@ +package org.amshove.kluent + +inline fun assertSoftly(assertions: () -> T): T { + // Handle the edge case of nested calls to this function by only calling throwCollectedErrors in the + // outermost verifyAll block + if (errorCollector.getCollectionMode() == ErrorCollectionMode.Soft) { + return assertions() + } + errorCollector.setCollectionMode(ErrorCollectionMode.Soft) + return assertions().apply { + errorCollector.throwCollectedErrors() + } +} + +inline fun assertSoftly(t: T, assertions: T.(T) -> Unit): T { + return assertSoftly { + t.assertions(t) + t + } +} \ No newline at end of file diff --git a/common/src/main/kotlin/org/amshove/kluent/StackTraces.kt b/common/src/main/kotlin/org/amshove/kluent/StackTraces.kt new file mode 100644 index 00000000..a47d3481 --- /dev/null +++ b/common/src/main/kotlin/org/amshove/kluent/StackTraces.kt @@ -0,0 +1,37 @@ +package org.amshove.kluent + +expect val stacktraces: StackTraces + +object BasicStackTraces : StackTraces { + override fun throwableLocation(t: Throwable): String? = null + override fun throwableLocation(t: Throwable, n: Int): List? = null + override fun cleanStackTrace(throwable: T): T = throwable + override fun root(throwable: Throwable): Throwable = throwable +} + +interface StackTraces { + + /** + * Returns the first line of this stack trace, skipping io.kotest if possible. + * On some platforms the stack trace may not be available and will return null. + */ + fun throwableLocation(t: Throwable): String? + + /** + * Returns the first n lines of this stack trace, skipping io.test if possible. + * On some platforms the stack trace may not be available and will return null. + */ + fun throwableLocation(t: Throwable, n: Int): List? + + /** + * Removes io.kotest stack elements from the given throwable if the platform supports stack traces, + * otherwise returns the exception as is. + */ + fun cleanStackTrace(throwable: T): T + + /** + * Returns the root cause of the given throwable. If it has no root cause, or the platform does + * not support causes, this will be returned. + */ + fun root(throwable: Throwable): Throwable +} diff --git a/common/src/main/kotlin/org/amshove/kluent/internal/Assertions.kt b/common/src/main/kotlin/org/amshove/kluent/internal/Assertions.kt index 3e6d8a46..9eb4acc7 100644 --- a/common/src/main/kotlin/org/amshove/kluent/internal/Assertions.kt +++ b/common/src/main/kotlin/org/amshove/kluent/internal/Assertions.kt @@ -1,15 +1,34 @@ package org.amshove.kluent.internal -import kotlin.test.assertFalse -import kotlin.test.assertTrue -import kotlin.test.fail +import org.amshove.kluent.* internal fun assertTrue(message: String, boolean: Boolean) = assertTrue(boolean, message) -internal inline fun assertTrue(boolean: Boolean, lazyMessage: () -> String) { - if (!boolean) fail(lazyMessage()) +internal fun assertTrue(actual: Boolean, message: String? = null) { + if (!actual) { + if (errorCollector.getCollectionMode() == ErrorCollectionMode.Soft) { + try { + throw AssertionError(message) + } catch (ex: AssertionError) { + errorCollector.pushError(ex) + } + } else { + try { + throw AssertionError(message) + } catch (ex: AssertionError) { + throw assertionError(ex) + } + } + } +} + +internal inline fun assertTrue(actual: Boolean, lazyMessage: () -> String) { + assertTrue(actual, lazyMessage()) } internal fun assertFalse(message: String, boolean: Boolean) = assertFalse(boolean, message) +fun assertFalse(actual: Boolean, message: String? = null) { + return assertTrue(message ?: "Expected value to be false.", !actual) +} internal fun assertArrayEquals(a1: Array?, a2: Array?) { if (!arraysEqual(a1, a2)) { @@ -86,8 +105,8 @@ internal fun failExpectedActual(message: String, expected: String?, actual: Stri internal fun failCollectionWithDifferentItems(message: String, expected: String?, actual: String?): Nothing = fail(""" |$message - |${ if(!expected.isNullOrEmpty()) "Items included on the expected collection but not in the actual: $expected" else "" } - |${ if(!actual.isNullOrEmpty()) "Items included on the actual collection but not in the expected: $actual" else "" } + |${if (!expected.isNullOrEmpty()) "Items included on the expected collection but not in the actual: $expected" else ""} + |${if (!actual.isNullOrEmpty()) "Items included on the actual collection but not in the expected: $actual" else ""} """.trimMargin()) internal fun failFirstSecond(message: String, first: String?, second: String?): Nothing = fail(""" @@ -104,4 +123,3 @@ fun assertSame(expected: Any?, actual: Any?) { fun assertNotSame(expected: Any?, actual: Any?) { assertTrue("Expected <$expected>, actual <$actual> are the same instance.", actual !== expected) } - diff --git a/common/src/main/kotlin/org/amshove/kluent/internal/Utility.kt b/common/src/main/kotlin/org/amshove/kluent/internal/Utility.kt index e53792be..c2a95fbb 100644 --- a/common/src/main/kotlin/org/amshove/kluent/internal/Utility.kt +++ b/common/src/main/kotlin/org/amshove/kluent/internal/Utility.kt @@ -7,3 +7,7 @@ internal fun join(theMap: Map): String = "Entries: [${theMap.entrie internal fun joinKeys(map: Map<*, *>) = "Keys: [${join(map.keys)}]" internal fun joinValues(map: Map<*, *>) = "Values: [${join(map.values)}]" internal fun joinPairs(map: Map<*, *>) = "Pairs: [${map.map { it.toPair() }.joinToString(", ")}]" + +internal fun fail(message: String): Nothing { + throw AssertionError(message) +} \ No newline at end of file diff --git a/common/src/test/kotlin/org/amshove/kluent/InternalAssertions.kt b/common/src/test/kotlin/org/amshove/kluent/InternalAssertions.kt index f9a37f5f..40a2b117 100644 --- a/common/src/test/kotlin/org/amshove/kluent/InternalAssertions.kt +++ b/common/src/test/kotlin/org/amshove/kluent/InternalAssertions.kt @@ -4,6 +4,14 @@ fun assertMessage(message: String, func: () -> Unit) { try { func() } catch (e: Throwable) { - e.message.shouldBeEqualTo(message) + e.message?.replace("\\s+|\\t|\\n".toRegex(), " ")?.trim().shouldBeEqualTo(message.replace("\\s+|\\t|\\n".toRegex(), " ").trim()) + } +} + +fun assertMessageContain(message: String, func: () -> Unit) { + try { + func() + } catch (e: Throwable) { + e.message?.contains(message, true) } } \ No newline at end of file diff --git a/common/src/test/kotlin/org/amshove/kluent/DataClasses.kt b/common/src/test/kotlin/org/amshove/kluent/tests/DataClasses.kt similarity index 64% rename from common/src/test/kotlin/org/amshove/kluent/DataClasses.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/DataClasses.kt index cc4aeaf6..d8277999 100644 --- a/common/src/test/kotlin/org/amshove/kluent/DataClasses.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/DataClasses.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent +package org.amshove.kluent.tests data class Person(val name: String, val surname: String) diff --git a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeDigitShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeDigitShould.kt similarity index 96% rename from common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeDigitShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeDigitShould.kt index 09d5af25..fd340d92 100644 --- a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeDigitShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeDigitShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.basic +package org.amshove.kluent.tests.basic import org.amshove.kluent.shouldBeDigit import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeFalseShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeFalseShould.kt similarity index 65% rename from common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeFalseShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeFalseShould.kt index e8ce0122..60a7a58b 100644 --- a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeFalseShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeFalseShould.kt @@ -1,7 +1,8 @@ -package org.amshove.kluent.basic +package org.amshove.kluent.tests.basic -import org.amshove.kluent.assertMessage import org.amshove.kluent.shouldBeFalse +import org.amshove.kluent.assertMessage +import org.amshove.kluent.assertMessageContain import kotlin.test.Test import kotlin.test.assertFails @@ -18,6 +19,8 @@ class ShouldBeFalseShould { @Test fun provideADescriptiveMessage() { - assertMessage("Expected value to be false, but was true") { true.shouldBeFalse() } + assertMessageContain("Expected value to be false, but was true") { + true.shouldBeFalse() + } } } \ No newline at end of file diff --git a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeNullShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeNullShould.kt similarity index 93% rename from common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeNullShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeNullShould.kt index 6dec463b..a89b5e63 100644 --- a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeNullShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeNullShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.basic +package org.amshove.kluent.tests.basic import org.amshove.kluent.shouldBeNull import org.amshove.kluent.shouldNotBeNull diff --git a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeShould.kt similarity index 87% rename from common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeShould.kt index 88bd3fee..9f80013c 100644 --- a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeShould.kt @@ -1,8 +1,8 @@ -package org.amshove.kluent.basic +package org.amshove.kluent.tests.basic import kotlin.test.Test -import org.amshove.kluent.Person import org.amshove.kluent.shouldBe +import org.amshove.kluent.tests.Person import kotlin.test.assertFails class ShouldBeShould { diff --git a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeTrueShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeTrueShould.kt similarity index 61% rename from common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeTrueShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeTrueShould.kt index 8c4d5315..2195f82d 100644 --- a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldBeTrueShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldBeTrueShould.kt @@ -1,7 +1,9 @@ -package org.amshove.kluent.basic +package org.amshove.kluent.tests.basic -import org.amshove.kluent.assertMessage import org.amshove.kluent.shouldBeTrue +import org.amshove.kluent.assertMessage +import org.amshove.kluent.assertMessageContain +import org.amshove.kluent.shouldBeFalse import kotlin.test.Test import kotlin.test.assertFails @@ -18,6 +20,8 @@ class ShouldBeTrueShould { @Test fun provideADescriptiveMessage() { - assertMessage("Expected value to be true, but was false") { false.shouldBeTrue() } + assertMessageContain("Expected value to be true, but was false") { + false.shouldBeTrue() + } } } \ No newline at end of file diff --git a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldEqualShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldEqualShould.kt similarity index 93% rename from common/src/test/kotlin/org/amshove/kluent/basic/ShouldEqualShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldEqualShould.kt index 2944adb8..355dcb6f 100644 --- a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldEqualShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldEqualShould.kt @@ -1,7 +1,7 @@ -package org.amshove.kluent.basic +package org.amshove.kluent.tests.basic -import org.amshove.kluent.Person import org.amshove.kluent.shouldBeEqualTo +import org.amshove.kluent.tests.Person import kotlin.test.Test import kotlin.test.assertFails diff --git a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeDigitShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeDigitShould.kt similarity index 96% rename from common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeDigitShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeDigitShould.kt index e4a0bf32..0dc39c90 100644 --- a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeDigitShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeDigitShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.basic +package org.amshove.kluent.tests.basic import org.amshove.kluent.shouldNotBeDigit import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeFalseShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeFalseShould.kt similarity index 88% rename from common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeFalseShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeFalseShould.kt index c9d7451c..015f3c76 100644 --- a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeFalseShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeFalseShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.basic +package org.amshove.kluent.tests.basic import org.amshove.kluent.shouldNotBeFalse import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeNullShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeNullShould.kt similarity index 94% rename from common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeNullShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeNullShould.kt index 8978e07c..69e569ae 100644 --- a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeNullShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeNullShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.basic +package org.amshove.kluent.tests.basic import org.amshove.kluent.shouldNotBe import org.amshove.kluent.shouldNotBeNull diff --git a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeShould.kt similarity index 87% rename from common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeShould.kt index 5c2c0827..8c5cb701 100644 --- a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeShould.kt @@ -1,8 +1,8 @@ -package org.amshove.kluent.basic +package org.amshove.kluent.tests.basic import kotlin.test.Test -import org.amshove.kluent.Person import org.amshove.kluent.shouldNotBe +import org.amshove.kluent.tests.Person import kotlin.test.assertFails class ShouldNotBeShould { diff --git a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeTrueShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeTrueShould.kt similarity index 88% rename from common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeTrueShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeTrueShould.kt index 6293eef4..0236fe4e 100644 --- a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotBeTrueShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotBeTrueShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.basic +package org.amshove.kluent.tests.basic import org.amshove.kluent.shouldNotBeTrue import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotEqualShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotEqualShould.kt similarity index 93% rename from common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotEqualShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotEqualShould.kt index 6f253986..156128fb 100644 --- a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldNotEqualShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldNotEqualShould.kt @@ -1,8 +1,8 @@ -package org.amshove.kluent.basic +package org.amshove.kluent.tests.basic -import org.amshove.kluent.Person import org.amshove.kluent.shouldBeEqualTo import org.amshove.kluent.shouldNotBeEqualTo +import org.amshove.kluent.tests.Person import kotlin.test.Test import kotlin.test.assertFails diff --git a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldShould.kt similarity index 96% rename from common/src/test/kotlin/org/amshove/kluent/basic/ShouldShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldShould.kt index 4e028784..44194de1 100644 --- a/common/src/test/kotlin/org/amshove/kluent/basic/ShouldShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/basic/ShouldShould.kt @@ -1,8 +1,8 @@ -package org.amshove.kluent.basic +package org.amshove.kluent.tests.basic import kotlin.test.Test -import org.amshove.kluent.Person import org.amshove.kluent.should +import org.amshove.kluent.tests.Person import kotlin.test.assertFails import kotlin.test.assertTrue diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldBeBlankShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldBeBlankShould.kt similarity index 87% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldBeBlankShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldBeBlankShould.kt index 56f1c800..854677cc 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldBeBlankShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldBeBlankShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldBeBlank import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldBeEmptyShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldBeEmptyShould.kt similarity index 87% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldBeEmptyShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldBeEmptyShould.kt index 423563bd..76358cfb 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldBeEmptyShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldBeEmptyShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldBeEmpty import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldBeNullOrBlankShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldBeNullOrBlankShould.kt similarity index 91% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldBeNullOrBlankShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldBeNullOrBlankShould.kt index f256edd4..0bdec919 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldBeNullOrBlankShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldBeNullOrBlankShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldBeNullOrBlank import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldBeNullOrEmptyShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldBeNullOrEmptyShould.kt similarity index 91% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldBeNullOrEmptyShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldBeNullOrEmptyShould.kt index 97750558..71920b21 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldBeNullOrEmptyShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldBeNullOrEmptyShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldBeNullOrEmpty import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldContainAllShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldContainAllShould.kt similarity index 92% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldContainAllShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldContainAllShould.kt index 0ea847f9..bf82ca71 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldContainAllShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldContainAllShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldContainAll import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldContainNoneShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldContainNoneShould.kt similarity index 94% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldContainNoneShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldContainNoneShould.kt index 7751bfa4..9ea490f3 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldContainNoneShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldContainNoneShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldContainNone import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldContainShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldContainShould.kt similarity index 92% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldContainShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldContainShould.kt index afed8153..0f9c8e5b 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldContainShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldContainShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldContain import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldContainSomeShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldContainSomeShould.kt similarity index 94% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldContainSomeShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldContainSomeShould.kt index 04afd6a9..142943de 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldContainSomeShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldContainSomeShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldContainSome import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldEndWithShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldEndWithShould.kt similarity index 89% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldEndWithShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldEndWithShould.kt index 048dd264..f6642d66 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldEndWithShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldEndWithShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldEndWith import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldMatchShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldMatchShould.kt similarity index 93% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldMatchShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldMatchShould.kt index 5c9c6f10..ccdb8653 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldMatchShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldMatchShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldMatch import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotBeBlankShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotBeBlankShould.kt similarity index 88% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotBeBlankShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotBeBlankShould.kt index 28a8d2f0..97d7b459 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotBeBlankShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotBeBlankShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldNotBeBlank import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotBeEmptyShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotBeEmptyShould.kt similarity index 88% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotBeEmptyShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotBeEmptyShould.kt index 51b8faa4..6ee0e0f1 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotBeEmptyShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotBeEmptyShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldNotBeEmpty import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotBeNullOrBlankShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotBeNullOrBlankShould.kt similarity index 94% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotBeNullOrBlankShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotBeNullOrBlankShould.kt index 696ecec6..6dfc7318 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotBeNullOrBlankShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotBeNullOrBlankShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldNotBeNullOrBlank import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotBeNullOrEmptyShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotBeNullOrEmptyShould.kt similarity index 94% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotBeNullOrEmptyShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotBeNullOrEmptyShould.kt index b81c0a5c..6ed1be5b 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotBeNullOrEmptyShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotBeNullOrEmptyShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldNotBeNullOrEmpty import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotContainAllShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotContainAllShould.kt similarity index 92% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotContainAllShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotContainAllShould.kt index 29d64588..65e3717f 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotContainAllShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotContainAllShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldNotContainAll import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotContainShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotContainShould.kt similarity index 93% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotContainShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotContainShould.kt index ca236834..c8e5900c 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotContainShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotContainShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldNotContain import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotEndWithShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotEndWithShould.kt similarity index 89% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotEndWithShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotEndWithShould.kt index 5308823a..c0fabb33 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotEndWithShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotEndWithShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldNotEndWith import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotMatchShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotMatchShould.kt similarity index 93% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotMatchShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotMatchShould.kt index ca72f3ba..a9eba221 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotMatchShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotMatchShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldNotMatch import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotStartWithShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotStartWithShould.kt similarity index 90% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotStartWithShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotStartWithShould.kt index 6b640a55..39225103 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldNotStartWithShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldNotStartWithShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldNotStartWith import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldStartWithShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldStartWithShould.kt similarity index 89% rename from common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldStartWithShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldStartWithShould.kt index 30a08cf0..82ec5079 100644 --- a/common/src/test/kotlin/org/amshove/kluent/charsequence/ShouldStartWithShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/charsequence/ShouldStartWithShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.charsequence +package org.amshove.kluent.tests.charsequence import org.amshove.kluent.shouldStartWith import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldBeEmptyShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldBeEmptyShould.kt similarity index 98% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldBeEmptyShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldBeEmptyShould.kt index 8ccbd3e4..163b94b3 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldBeEmptyShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldBeEmptyShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldBeEmpty import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldBeInRangeShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldBeInRangeShould.kt similarity index 92% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldBeInRangeShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldBeInRangeShould.kt index 56bbf979..167ae854 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldBeInRangeShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldBeInRangeShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldBeInRange import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldBeInShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldBeInShould.kt similarity index 97% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldBeInShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldBeInShould.kt index 906e2b20..2ece9b2c 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldBeInShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldBeInShould.kt @@ -1,7 +1,7 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import kotlin.test.Test -import org.amshove.kluent.Person +import org.amshove.kluent.tests.Person import org.amshove.kluent.shouldBeIn import kotlin.test.assertFails diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldBeSortedAccordingToShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldBeSortedAccordingToShould.kt similarity index 98% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldBeSortedAccordingToShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldBeSortedAccordingToShould.kt index 5c903538..9266f109 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldBeSortedAccordingToShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldBeSortedAccordingToShould.kt @@ -1,6 +1,6 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections -import org.amshove.kluent.Person +import org.amshove.kluent.tests.Person import org.amshove.kluent.shouldBeSortedAccordingTo import kotlin.random.Random import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainAllShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainAllShould.kt similarity index 99% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainAllShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainAllShould.kt index b5a7d359..15428d24 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainAllShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainAllShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldContainAll import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainAnyShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainAnyShould.kt similarity index 98% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainAnyShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainAnyShould.kt index 43421b62..5627f47a 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainAnyShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainAnyShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.* diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainFalseShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainFalseShould.kt similarity index 91% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainFalseShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainFalseShould.kt index 64ba591c..6c3542dc 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainFalseShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainFalseShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldContainFalse import org.amshove.kluent.shouldContainTrue diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainNoneShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainNoneShould.kt similarity index 99% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainNoneShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainNoneShould.kt index 60909143..2e87af62 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainNoneShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainNoneShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldContainNone import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainSameShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainSameShould.kt similarity index 99% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainSameShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainSameShould.kt index d78079b0..13c950c0 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainSameShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainSameShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldContainSame import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainShould.kt similarity index 98% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainShould.kt index b5f66dab..041f4733 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainShould.kt @@ -1,6 +1,6 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections -import org.amshove.kluent.Person +import org.amshove.kluent.tests.Person import org.amshove.kluent.shouldContain import kotlin.test.Test import kotlin.test.assertFails diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainSingleItemShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainSingleItemShould.kt similarity index 97% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainSingleItemShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainSingleItemShould.kt index 8e9cf936..f562836f 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainSingleItemShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainSingleItemShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldBeEqualTo import org.amshove.kluent.shouldHaveSingleItem diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainSomeShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainSomeShould.kt similarity index 99% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainSomeShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainSomeShould.kt index c9c95c03..3ba7a034 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainSomeShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainSomeShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldContainSome import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainTrueShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainTrueShould.kt similarity index 91% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainTrueShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainTrueShould.kt index 757c8f4d..f4f0e86c 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldContainTrueShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldContainTrueShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldContainFalse import org.amshove.kluent.shouldContainTrue diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldEqualShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldEqualShould.kt similarity index 98% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldEqualShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldEqualShould.kt index a7725832..d38b9433 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldEqualShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldEqualShould.kt @@ -1,7 +1,7 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldBeEqualTo -import org.amshove.kluent.Person +import org.amshove.kluent.tests.Person import kotlin.test.assertFails import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldEqualUnorderedShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldEqualUnorderedShould.kt similarity index 78% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldEqualUnorderedShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldEqualUnorderedShould.kt index d4075f86..dbdfe1ae 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldEqualUnorderedShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldEqualUnorderedShould.kt @@ -1,8 +1,10 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections -import org.amshove.kluent.* +import org.amshove.kluent.shouldBeEqualTo +import org.amshove.kluent.shouldEqualUnordered import kotlin.test.Test import kotlin.test.assertFails +import org.amshove.kluent.tests.Person class ShouldEqualUnorderedShould { @Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldHaveKeyShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldHaveKeyShould.kt similarity index 92% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldHaveKeyShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldHaveKeyShould.kt index 02e9da7f..985ad67d 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldHaveKeyShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldHaveKeyShould.kt @@ -1,7 +1,7 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldHaveKey -import org.amshove.kluent.Person +import org.amshove.kluent.tests.Person import kotlin.test.Test import kotlin.test.assertFails diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldHaveSingleItemShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldHaveSingleItemShould.kt similarity index 98% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldHaveSingleItemShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldHaveSingleItemShould.kt index 5d6a2745..110dbf75 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldHaveSingleItemShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldHaveSingleItemShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldHaveSingleItem import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldHaveSizeShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldHaveSizeShould.kt similarity index 96% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldHaveSizeShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldHaveSizeShould.kt index 8ab8f57c..81068b88 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldHaveSizeShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldHaveSizeShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldHaveSize import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldHaveValueShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldHaveValueShould.kt similarity index 92% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldHaveValueShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldHaveValueShould.kt index 38ec16fa..12214ba3 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldHaveValueShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldHaveValueShould.kt @@ -1,7 +1,7 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldHaveValue -import org.amshove.kluent.Person +import org.amshove.kluent.tests.Person import kotlin.test.assertFails import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldMatchPredicateShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldMatchPredicateShould.kt similarity index 96% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldMatchPredicateShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldMatchPredicateShould.kt index 52e67271..28ed0f57 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldMatchPredicateShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldMatchPredicateShould.kt @@ -1,6 +1,6 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections -import org.amshove.kluent.Person +import org.amshove.kluent.tests.Person import org.amshove.kluent.shouldMatchAllWith import org.amshove.kluent.shouldMatchAtLeastOneOf import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotBeEmptyShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotBeEmptyShould.kt similarity index 98% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotBeEmptyShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotBeEmptyShould.kt index 89d58f40..f89fc884 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotBeEmptyShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotBeEmptyShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldNotBeEmpty import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotBeInRangeShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotBeInRangeShould.kt similarity index 92% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotBeInRangeShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotBeInRangeShould.kt index 17e07fa4..001d3b52 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotBeInRangeShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotBeInRangeShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldNotBeInRange import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotBeInShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotBeInShould.kt similarity index 97% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotBeInShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotBeInShould.kt index 35bf9139..48edc099 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotBeInShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotBeInShould.kt @@ -1,7 +1,7 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import kotlin.test.assertFails -import org.amshove.kluent.Person +import org.amshove.kluent.tests.Person import org.amshove.kluent.shouldNotBeIn import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotContainAnyShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotContainAnyShould.kt similarity index 99% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotContainAnyShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotContainAnyShould.kt index d4067caa..8dd4d858 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotContainAnyShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotContainAnyShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldNotContainAny import kotlin.test.assertFails diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotContainShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotContainShould.kt similarity index 98% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotContainShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotContainShould.kt index 1420e953..ce566b7a 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotContainShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotContainShould.kt @@ -1,7 +1,7 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldNotContain -import org.amshove.kluent.Person +import org.amshove.kluent.tests.Person import kotlin.test.Test import kotlin.test.assertFails diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotEqualShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotEqualShould.kt similarity index 97% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotEqualShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotEqualShould.kt index 31f65a9f..ae46dce0 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotEqualShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotEqualShould.kt @@ -1,8 +1,7 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections -import org.amshove.kluent.Person +import org.amshove.kluent.tests.Person import org.amshove.kluent.shouldNotBeEqualTo -import org.amshove.kluent.shouldNotEqual import kotlin.test.Test import kotlin.test.assertFails diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotEqualUnorderedShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotEqualUnorderedShould.kt similarity index 89% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotEqualUnorderedShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotEqualUnorderedShould.kt index b9df63c5..24aeca6c 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotEqualUnorderedShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotEqualUnorderedShould.kt @@ -1,7 +1,7 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections -import org.amshove.kluent.Person import org.amshove.kluent.shouldNotEqualUnordered +import org.amshove.kluent.tests.Person import kotlin.test.Test import kotlin.test.assertFails diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotHaveKeyShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotHaveKeyShould.kt similarity index 92% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotHaveKeyShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotHaveKeyShould.kt index 527f5400..b26907c5 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotHaveKeyShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotHaveKeyShould.kt @@ -1,7 +1,7 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections import org.amshove.kluent.shouldNotHaveKey -import org.amshove.kluent.Person +import org.amshove.kluent.tests.Person import kotlin.test.Test import kotlin.test.assertFails diff --git a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotHaveValueShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotHaveValueShould.kt similarity index 92% rename from common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotHaveValueShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotHaveValueShould.kt index 15b6cf45..c0a72ac6 100644 --- a/common/src/test/kotlin/org/amshove/kluent/collections/ShouldNotHaveValueShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/collections/ShouldNotHaveValueShould.kt @@ -1,6 +1,6 @@ -package org.amshove.kluent.collections +package org.amshove.kluent.tests.collections -import org.amshove.kluent.Person +import org.amshove.kluent.tests.Person import org.amshove.kluent.shouldNotHaveValue import kotlin.test.assertFails import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/concepts/ChainingAssertionsShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/concepts/ChainingAssertionsShould.kt similarity index 96% rename from common/src/test/kotlin/org/amshove/kluent/concepts/ChainingAssertionsShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/concepts/ChainingAssertionsShould.kt index de334da1..7825b940 100644 --- a/common/src/test/kotlin/org/amshove/kluent/concepts/ChainingAssertionsShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/concepts/ChainingAssertionsShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.concepts +package org.amshove.kluent.tests.concepts import org.amshove.kluent.* import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeGreaterOrEqualToShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeGreaterOrEqualToShould.kt similarity index 96% rename from common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeGreaterOrEqualToShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeGreaterOrEqualToShould.kt index 8f9f1647..05913a48 100644 --- a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeGreaterOrEqualToShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeGreaterOrEqualToShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.numerical +package org.amshove.kluent.tests.numerical import org.amshove.kluent.shouldBeGreaterOrEqualTo import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeGreaterThanShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeGreaterThanShould.kt similarity index 96% rename from common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeGreaterThanShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeGreaterThanShould.kt index 04ed97b6..6da713b1 100644 --- a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeGreaterThanShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeGreaterThanShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.numerical +package org.amshove.kluent.tests.numerical import org.amshove.kluent.shouldBeGreaterThan import kotlin.test.assertFails diff --git a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeInRangeShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeInRangeShould.kt similarity index 98% rename from common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeInRangeShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeInRangeShould.kt index a41e42f1..c6cb8a94 100644 --- a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeInRangeShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeInRangeShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.numerical +package org.amshove.kluent.tests.numerical import org.amshove.kluent.shouldBeInRange import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeLessOrEqualToShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeLessOrEqualToShould.kt similarity index 96% rename from common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeLessOrEqualToShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeLessOrEqualToShould.kt index 423f0d15..9130cc4b 100644 --- a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeLessOrEqualToShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeLessOrEqualToShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.numerical +package org.amshove.kluent.tests.numerical import org.amshove.kluent.shouldBeLessOrEqualTo import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeLessThanShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeLessThanShould.kt similarity index 94% rename from common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeLessThanShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeLessThanShould.kt index c1e5df77..45c4665c 100644 --- a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeLessThanShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeLessThanShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.numerical +package org.amshove.kluent.tests.numerical import org.amshove.kluent.shouldBeLessThan import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeNearShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeNearShould.kt similarity index 98% rename from common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeNearShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeNearShould.kt index b986299b..da136dc9 100644 --- a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeNearShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeNearShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.numerical +package org.amshove.kluent.tests.numerical import org.amshove.kluent.shouldBeNear import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeNegativeShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeNegativeShould.kt similarity index 96% rename from common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeNegativeShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeNegativeShould.kt index 41d0252f..e347e1bb 100644 --- a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBeNegativeShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBeNegativeShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.numerical +package org.amshove.kluent.tests.numerical import org.amshove.kluent.shouldBeNegative import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBePositiveShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBePositiveShould.kt similarity index 96% rename from common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBePositiveShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBePositiveShould.kt index 607bcd2b..ea231db4 100644 --- a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldBePositiveShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldBePositiveShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.numerical +package org.amshove.kluent.tests.numerical import org.amshove.kluent.shouldBePositive import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldNotBeGreaterOrEqualToShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldNotBeGreaterOrEqualToShould.kt similarity index 96% rename from common/src/test/kotlin/org/amshove/kluent/numerical/ShouldNotBeGreaterOrEqualToShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldNotBeGreaterOrEqualToShould.kt index 75c35fe9..43b66092 100644 --- a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldNotBeGreaterOrEqualToShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldNotBeGreaterOrEqualToShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.numerical +package org.amshove.kluent.tests.numerical import org.amshove.kluent.shouldNotBeGreaterOrEqualTo import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldNotBeGreaterThanShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldNotBeGreaterThanShould.kt similarity index 96% rename from common/src/test/kotlin/org/amshove/kluent/numerical/ShouldNotBeGreaterThanShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldNotBeGreaterThanShould.kt index e1337c27..b9370eca 100644 --- a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldNotBeGreaterThanShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldNotBeGreaterThanShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.numerical +package org.amshove.kluent.tests.numerical import org.amshove.kluent.shouldNotBeGreaterThan import kotlin.test.Test diff --git a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldNotBeInRangeShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldNotBeInRangeShould.kt similarity index 98% rename from common/src/test/kotlin/org/amshove/kluent/numerical/ShouldNotBeInRangeShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldNotBeInRangeShould.kt index 99e23838..51426cf1 100644 --- a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldNotBeInRangeShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldNotBeInRangeShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.numerical +package org.amshove.kluent.tests.numerical import org.amshove.kluent.shouldNotBeInRange import kotlin.test.assertFails diff --git a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldNotBeLessOrEqualToShould.kt b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldNotBeLessOrEqualToShould.kt similarity index 96% rename from common/src/test/kotlin/org/amshove/kluent/numerical/ShouldNotBeLessOrEqualToShould.kt rename to common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldNotBeLessOrEqualToShould.kt index 72baf500..b2a22933 100644 --- a/common/src/test/kotlin/org/amshove/kluent/numerical/ShouldNotBeLessOrEqualToShould.kt +++ b/common/src/test/kotlin/org/amshove/kluent/tests/numerical/ShouldNotBeLessOrEqualToShould.kt @@ -1,4 +1,4 @@ -package org.amshove.kluent.numerical +package org.amshove.kluent.tests.numerical import org.amshove.kluent.shouldNotBeLessOrEqualTo import kotlin.test.Test diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7c4388a9..558870da 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/js/src/main/kotlin/org/amshove/kluent/ErrorCollector.kt b/js/src/main/kotlin/org/amshove/kluent/ErrorCollector.kt new file mode 100644 index 00000000..7fb10b4a --- /dev/null +++ b/js/src/main/kotlin/org/amshove/kluent/ErrorCollector.kt @@ -0,0 +1,5 @@ +package org.amshove.kluent + +actual val errorCollector: ErrorCollector = JsErrorCollector + +object JsErrorCollector : BasicErrorCollector() \ No newline at end of file diff --git a/js/src/main/kotlin/org/amshove/kluent/StackTraces.kt b/js/src/main/kotlin/org/amshove/kluent/StackTraces.kt new file mode 100644 index 00000000..bfdafd49 --- /dev/null +++ b/js/src/main/kotlin/org/amshove/kluent/StackTraces.kt @@ -0,0 +1,3 @@ +package org.amshove.kluent + +actual val stacktraces: StackTraces = BasicStackTraces diff --git a/jvm/src/main/kotlin/org/amshove/kluent/Equivalency.kt b/jvm/src/main/kotlin/org/amshove/kluent/Equivalency.kt index c2da203e..b1811b14 100644 --- a/jvm/src/main/kotlin/org/amshove/kluent/Equivalency.kt +++ b/jvm/src/main/kotlin/org/amshove/kluent/Equivalency.kt @@ -1,11 +1,11 @@ package org.amshove.kluent +import org.amshove.kluent.internal.fail import java.lang.reflect.InvocationTargetException import java.util.* import kotlin.reflect.KProperty1 import kotlin.reflect.KVisibility import kotlin.reflect.full.declaredMemberProperties -import kotlin.test.fail @ExperimentalStdlibApi fun T.shouldBeEquivalentTo(expected: T, config: ((EquivalencyAssertionOptions) -> EquivalencyAssertionOptions)? = null): T = this.apply { assertEquivalency(false, expected, this, config) } diff --git a/jvm/src/main/kotlin/org/amshove/kluent/UserStackTraceConverter.kt b/jvm/src/main/kotlin/org/amshove/kluent/UserStackTraceConverter.kt new file mode 100644 index 00000000..564df2a3 --- /dev/null +++ b/jvm/src/main/kotlin/org/amshove/kluent/UserStackTraceConverter.kt @@ -0,0 +1,42 @@ +package org.amshove.kluent + +object UserStackTraceConverter { + + fun getUserStacktrace(kotestStacktraces: Array): Array { + return kotestStacktraces.dropUntilUserClass() + } + + /** + * Drops stacktraces until it finds a Kotest Stacktrace then drops stacktraces until it finds a non-Kotest stacktrace + * + * Sometimes, it's possible for the Stacktrace to contain classes that are not from Kotest, + * such as classes from sun.reflect or anything from Java. After clearing these classes, we'll be at Kotest + * stacktrace, which will contain exceptions from the Runners and some other classes + * After everything from Kotest we'll finally be at user classes, at which point the stacktrace is clean and is + * returned. + */ + private fun Array.dropUntilUserClass(): Array { + return toList().dropUntilFirstKotestClass().dropUntilFirstNonKotestClass().toTypedArray() + } + + private fun List.dropUntilFirstKotestClass(): List { + return dropWhile { + it.isNotKotestClass() + } + } + + private fun List.dropUntilFirstNonKotestClass(): List { + return dropWhile { + it.isKotestClass() + } + } + + private fun StackTraceElement.isKotestClass(): Boolean { + return className.startsWith("org.amshove.kluent") + } + + private fun StackTraceElement.isNotKotestClass(): Boolean { + return !isKotestClass() + } + +} \ No newline at end of file diff --git a/jvm/src/main/kotlin/org/amshove/kluent/errorCollector.kt b/jvm/src/main/kotlin/org/amshove/kluent/errorCollector.kt new file mode 100644 index 00000000..93d88fde --- /dev/null +++ b/jvm/src/main/kotlin/org/amshove/kluent/errorCollector.kt @@ -0,0 +1,50 @@ +@file:JvmName("jvmerrorcollector") + +package org.amshove.kluent + +import java.util.* + +actual val errorCollector: ErrorCollector = ThreadLocalErrorCollector + +object ThreadLocalErrorCollector : ErrorCollector { + + private val clueContext = object : ThreadLocal>() { + override fun initialValue(): Stack = Stack() + } + + private val failures = object : ThreadLocal>() { + override fun initialValue(): MutableList = mutableListOf() + } + + private val collectionMode = object : ThreadLocal() { + override fun initialValue() = ErrorCollectionMode.Hard + } + + override fun setCollectionMode(mode: ErrorCollectionMode) = collectionMode.set(mode) + + override fun getCollectionMode(): ErrorCollectionMode = collectionMode.get() + + override fun pushClue(clue: Clue) { + clueContext.get().push(clue) + } + + override fun popClue() { + clueContext.get().pop() + } + + override fun clueContext(): List = clueContext.get() + + override fun errors(): List = failures.get().toList() + + /** + * Adds the given error to the current context. + */ + override fun pushError(t: Throwable) { + failures.get().add(t) + } + + /** + * Clears all errors from the current context. + */ + override fun clear() = failures.get().clear() +} \ No newline at end of file diff --git a/jvm/src/main/kotlin/org/amshove/kluent/stacktraces.kt b/jvm/src/main/kotlin/org/amshove/kluent/stacktraces.kt new file mode 100644 index 00000000..05567bf5 --- /dev/null +++ b/jvm/src/main/kotlin/org/amshove/kluent/stacktraces.kt @@ -0,0 +1,26 @@ +@file:JvmName("stacktracesjvm") + +package org.amshove.kluent + +actual val stacktraces: StackTraces = object : StackTraces { + + override fun throwableLocation(t: Throwable): String? { + return throwableLocation(t, 1)?.firstOrNull() + } + + override fun throwableLocation(t: Throwable, n: Int): List? { + return (t.cause ?: t).stackTrace?.dropWhile { + it.className.startsWith("org.amshove.kluent") && !it.className.startsWith("org.amshove.kluent.test") + }?.take(n)?.map { it.toString() } ?: emptyList() + } + + override fun cleanStackTrace(throwable: T): T { + throwable.stackTrace = UserStackTraceConverter.getUserStacktrace(throwable.stackTrace) + return throwable + } + + override fun root(throwable: Throwable): Throwable { + val cause = throwable.cause + return if (cause == null) throwable else root(cause) + } +} diff --git a/jvm/src/test/kotlin/org/amshove/kluent/tests/assertions/softly/AssertSoftly.kt b/jvm/src/test/kotlin/org/amshove/kluent/tests/assertions/softly/AssertSoftly.kt new file mode 100644 index 00000000..f2d89cd6 --- /dev/null +++ b/jvm/src/test/kotlin/org/amshove/kluent/tests/assertions/softly/AssertSoftly.kt @@ -0,0 +1,85 @@ +package org.amshove.kluent.tests.assertions.softly + +import org.amshove.kluent.* +import kotlin.test.Test + +class AssertSoftly { + @Test + fun failShouldAssertSoftly() { + // arrange + val a = "ab1" + + // act + try { + assertSoftly(a) { + shouldNotBeNull() + shouldContain("2") + length.shouldBeGreaterOrEqualTo(4) + } + } catch (e: Throwable) { + e.message!!.replace("\\s+|\\t|\\n".toRegex(), " ").trim().shouldBeEqualTo(""" + The following 2 assertions failed: + 1) Expected the CharSequence ab1 to contain 2 + at org.amshove.kluent.tests.assertions.softly.AssertSoftly.failShouldAssertSoftly(AssertSoftly.kt:16) + 2) Expected 3 to be greater or equal to 4 + at org.amshove.kluent.tests.assertions.softly.AssertSoftly.failShouldAssertSoftly(AssertSoftly.kt:17)""".replace("\\s+|\\t|\\n".toRegex(), " ").trim()) + } + } + + @Test + fun passShouldAssertSoftly() { + // arrange + val a = "ab1" + + // act + assertSoftly(a) { + shouldNotBeNull() + shouldContain("1") + length.shouldBeGreaterOrEqualTo(3) + } + } + + @Test + fun verifyAssertErrorForNonSoftlyAssertions() { + // arrange + val a = "ab1" + + // act + try { + with(a) { + shouldNotBeNull() + shouldContain("2") + length.shouldBeGreaterOrEqualTo(4) + } + } catch (e: Throwable) { + e.message!!.replace("\\s+|\\t|\\n".toRegex(), " ").trim().shouldBeEqualTo(""" + The following assertion failed: + Expected the CharSequence ab1 to contain 2 + at org.amshove.kluent.tests.assertions.softly.AssertSoftly.verifyAssertErrorForNonSoftlyAssertions(AssertSoftly.kt:51)""" + .replace("\\s+|\\t|\\n".toRegex(), " ").trim()) + } + } + + @Test + fun failShouldAssertSoftlyForSeveralObjects() { + // arrange + val a = "ab1" + val b = "ab2" + + // act + try { + assertSoftly { + a.shouldNotBeNull() + b.shouldContain("2") + a.length.shouldBeGreaterOrEqualTo(4) + } + } catch (e: Throwable) { + e.message!!.replace("\\s+|\\t|\\n".toRegex(), " ").trim().shouldBeEqualTo(""" + The following assertion failed: + Expected 3 to be greater or equal to 4 + at org.amshove.kluent.tests.assertions.softly.AssertSoftly.failShouldAssertSoftlyForSeveralObjects(AssertSoftly.kt:74)""" + .replace("\\s+|\\t|\\n".toRegex(), " ").trim()) + } + } + +} \ No newline at end of file diff --git a/jvm/src/test/kotlin/org/amshove/kluent/tests/collections/BackticksShould.kt b/jvm/src/test/kotlin/org/amshove/kluent/tests/collections/BackticksShould.kt index 553d18f9..2b79c875 100644 --- a/jvm/src/test/kotlin/org/amshove/kluent/tests/collections/BackticksShould.kt +++ b/jvm/src/test/kotlin/org/amshove/kluent/tests/collections/BackticksShould.kt @@ -1,6 +1,6 @@ package org.amshove.kluent.tests.collections -import org.amshove.kluent.Person +import org.amshove.kluent.tests.Person import org.amshove.kluent.`should match at least one of` import kotlin.test.Test diff --git a/native/src/main/kotlin/org/amshove/kluent/ErrorCollector.kt b/native/src/main/kotlin/org/amshove/kluent/ErrorCollector.kt new file mode 100644 index 00000000..f571c76f --- /dev/null +++ b/native/src/main/kotlin/org/amshove/kluent/ErrorCollector.kt @@ -0,0 +1,5 @@ +package org.amshove.kluent + +actual val errorCollector: ErrorCollector = NativeErrorCollector + +object NativeErrorCollector : BasicErrorCollector() \ No newline at end of file diff --git a/native/src/main/kotlin/org/amshove/kluent/StackTraces.kt b/native/src/main/kotlin/org/amshove/kluent/StackTraces.kt new file mode 100644 index 00000000..219ac460 --- /dev/null +++ b/native/src/main/kotlin/org/amshove/kluent/StackTraces.kt @@ -0,0 +1,3 @@ +package org.amshove.kluent + +actual val stacktraces: StackTraces = BasicStackTraces \ No newline at end of file