Skip to content

Releases: willowtreeapps/assertk

0.28.1

17 Apr 21:35
Compare
Choose a tag to compare

[0.28.1] 2024-04-17

Added

  • Added core wasmWasi support, wasmJs to coroutines

v0.28.0

05 Dec 23:47
Compare
Choose a tag to compare

[0.28.0] 2023-12-05

Changed

  • Minimum supported kotlin version is 1.9.21
  • Rename isSameAs/isNotSameAs to isSameInstanceAs/isNotSameInstanceAs to make it more clear they
    use are about instance identity, old name is deprecated
  • Rename containsAll to containsAtLeast to make it more clear that the collection can contain additional elements,
    old name is deprecated
  • Bytes are shown as hex on all supported platforms (previously it was only on the jvm)
  • If isEqualTo fails and the expected and actual display the same string, print a disambiguation message, ex:
    expected:<4> with type:<class kotlin.Int> but was type:<class kotlin.Short> with the same string representation
    

Breaking Changes

  • Binary-breaking change as previous error-level deprecations were removed

Added

  • Added doesNotContainKey assertion for Map

Fixed

  • Fixed incorrect usage of contains in some kdoc examples
  • Exceptions being swallowed if thrown in a soft assertion block
  • More correctly re-throw fatal error in the jvm

v0.27.0

13 Sep 19:44
Compare
Choose a tag to compare

[0.27.0] 2023-09-13

Changed

  • Minimum supported kotlin version is 1.9.0
  • Added support for WASM targets (note: this only applies to the core library
    and not assertk-coroutines as the coroutines library doesn't have a stable
    release for it yet)

Breaking Changes

  • Previous assertThat {} deprecation warning is now an error

v0.26.1

19 May 04:45
v0.26.1
Compare
Choose a tag to compare

[0.26.1] 2023-05-18

Fixed

  • Made assertFailure {} inline like assertThat {} was to allow testing suspend function failures.

v0.26

13 May 00:19
Compare
Choose a tag to compare

[0.26] 2023-05-12

Changed

  • Minimum supported kotlin version is 1.8.10
  • Minimum supported coroutines version is 1.7.0
  • When asserting on a Throwable or failed Result, their exception is added as the cause to any
    AssertionErrors which are thrown as the result of an assertion failure.
  • Removed second type parameter on Any.isInstanceOf extension. In practice this would generally widen
    to Any which is what it has been replaced with.

Breaking Changes

  • Previous deprecations are now errors

Added

  • Added assertFailure { } entrypoint which is a shorthand for assertThat(runCatching { .. }).isFailure()
  • Added first and single assertion for Iterable
  • Added containsMatch assertion for CharSequence.
    Unlike 'contains' this is a regex rather than a literal.
    Unlike 'matches' this looks for a subset of the CharSequence to match rather than the entire contents.
  • Added reified overloads of hasClass, doesNotHaveClass, isInstanceOf, and isNotInstanceOf.
    For example: isInstanceOf<String>().
  • Added sequence assertions to mirror iterable
  • Added array assertions for UByteArray, UShortArray, UIntArray, and ULongArray.

Deprecated

  • Lambda-accepting assertThat { } entrypoint is now deprecated.
    Use assertThat(T) for normal values or assertFailure { } for exception-throwing code.

Fixed

  • Fixed iterable assertions that take a block that could have multiple assertions.
    Includes: none,atLeast,atMost,exactly, and any

v0.25

13 Sep 01:44
Compare
Choose a tag to compare

[0.25] 2021-09-12

Changed

  • Minimum supported kotlin version is 1.5.30
  • Minimum supported coroutines version is 1.5.2
  • Replaced custom result type returned from assertThat {} with kotlin.Result. This is a binary-incompatible change,
    but it should be source-compatible in most cases as referencing the custom result type directly was discouraged.

Added

  • Added startsWith() and endsWith() for List.
  • Added Optional<>.isPresent(), Optional<>.isEmpty(), Optional<>.hasValue()
  • Added expanded set of apple targets for kotlin native.

Fixed

  • Fixed behavior of isEqualToIgnoringGivenProperties to only check accessible properties.
  • Added prop which can take a member function. This restores much of the functionality deprecated
    in 0.23, while preserving the useful type-safety of the new overloads.

v0.24

05 May 15:19
Compare
Choose a tag to compare

[0.24] 2021-05-05

Fixed

  • Fixed any breaking when the list had several items.

Added

  • Added containsSubList for List.
  • Added exists for Path.

v0.23.1

05 Feb 18:37
Compare
Choose a tag to compare

[0.23.1] 2021-02-03

Fixed

  • Fixed containsExactly failing on custom list types.
  • Fixed NullPointerException in isDataClassEqualTo when a property is null.
  • Fixed multiple failures breaking any
  • Fixed map's containsOnly to ensure keys match up with values.
  • Fixed map's contain methods null handling.

v0.23

03 Sep 16:47
Compare
Choose a tag to compare

Changed

  • Minimum supported kotlin version is 1.4.0
  • Multiplatform artifacts are published as a single artifact. You can now just write
    sourceSets {
      commonTest {
        dependencies {
           implementation "com.willowtreeapps.assertk:assertk:..."
        }
      }
    }

instead of defining one for each platform.

  • Added support for the Kotlin/JS IR compiler
  • Added optional displayActual function to assertThat as an alternative to .toString() for external types
  • Moved most String assertions to CharSequence

Added

  • Added prop function with KProperty1 argument.
  • Added containsExactlyInAnyOrder assertion for Iterable and primitive arrays
  • Added initial Coroutines artifact (additional support planned for the future)

Deprecated

  • Deprecated prop function with KCallable argument. Use the new overload
    with type-safe KProperty1 argument or another overload with explicit name and lambda.

Fixed

  • Primitive array 'contains' methods now work with NaN. ex:
    assertThat(floatArrayOf(Float.Nan)).contains(Float.NaN)
    will pass when it failed before.
  • Fixes a bug causing failures to sometimes be dropped in a nested assertion context

v0.22

30 Jul 15:28
Compare
Choose a tag to compare

Added

  • Add multi-value support for Assert<String>.contains() and doesNotContain()
  • Add isEqualByComparingTo to compare objects by compareTo instead of equals this is useful for cases like
    BigDecimal where equals would fail because of differing precision.
  • Add containsOnly for arrays.

Changed

  • Minimum supported kotlin version is 1.3.70
  • Updated opentest4j to 1.2.0. This changes the multiple assertion message to include each exception class name.
  • Moved containsAll, containsNone, and containsOnly from Collection to Iterable to make
    them a bit more flexible.
  • containsAll, containsNone, and containsOnly error messages now include the expected and actual lists.
  • Unwrap exceptions thrown by prop(callable: KCallable<*>) to make them more clear.
  • Add all exception stacktraces to a MultipleFailuresError with Throwable.addSurpressed on the jvm (used when
    collecting multiple exceptions with assertAll). Unfortunately, if you are using gradle you won't see this due to a
    known gradle issue.
  • No longer wrap exceptions in AssertionErrors when using given and transform. Warning: this is techinicaly a
    breaking change as code like:
    try {
        assertThat(foo).given { throw MyException("error") }
    } catch (e: AssertionError) {
        // assume caught
    }
    will no longer be caught. But you shouldn't be writing code like that anyway ;)

Fixed

  • Don't let assertAll capture OutOfMemory errors.

Breaking Changes

  • Previously deprecated methods (as of 0.18) are now errors.