Skip to content

Conversation

AlexCue987
Copy link
Owner

No description provided.

hoonloper and others added 5 commits June 3, 2024 04:20
<!-- 
If this PR updates documentation, please update all relevant versions of
the docs, see:
https://github.com/kotest/kotest/tree/master/documentation/versioned_docs
The documentation at
https://github.com/kotest/kotest/tree/master/documentation/docs is the
documentation for the next minor or major version _TO BE RELEASED_
-->

**Thanks for creating a great testing tool called kotest🙂**

While reading the documentation, I found something wrong and fixed it.


![image](https://github.com/kotest/kotest/assets/78959175/f9a59820-adfa-4f7e-93f7-baa745be9468)

In the Conditional tests with enabled flags example code, I'm using
`it.name.startsWith(...)`, whereas in the current specification I can
access it as `it.name.testName.startsWith(...)`.

I've seen the error appear in versions 5.2 to 5.9, and I've fixed them
all.
(Please excuse the awkwardness of the PR due to translation)

I always support kotest👍
This PR introduces the ability to match substrings and regular
expressions in the stacktrace of a `Throwable` in the Kotest assertions
library. This feature can be useful when writing tests that need to
assert on specific parts of a stacktrace.

Changes:

1. Added two new infix functions `shouldHaveStacktraceContaining` and
`shouldNotHaveStacktraceContaining` to the `Throwable` class. These
functions accept a `String` or `Regex` and use it to match against the
stacktrace of the `Throwable`.
2. Added corresponding matcher functions `haveStacktraceContaining` that
create a `Matcher<Throwable>` to perform the actual matching logic.
3. Added tests for these new functions in `ThrowableMatchersTest.kt`.

This enhancement provides more flexibility when writing tests involving
exceptions and their stacktraces.

---------

Co-authored-by: Sam <sam@sksamuel.com>
Co-authored-by: Emil Kantis <emil.kantis@protonmail.com>
…otest#3929)

* Added matchEach matcher that receives an expected list and an asserter
to verify elements from both lists
* Added shouldMatchEach extensions for List, Iterable and Sequence

---------

Co-authored-by: Sam <sam@sksamuel.com>
Co-authored-by: Emil Kantis <emil.kantis@protonmail.com>
@AlexCue987 AlexCue987 merged commit 1693fe5 into fix-containExactly-verifier Jun 3, 2024
@AlexCue987 AlexCue987 deleted the fix-containExactly-verifier-merge-master branch June 3, 2024 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants