Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShouldExistInOrderTest.kt #30

Merged
merged 1 commit into from
Feb 13, 2024
Merged

Conversation

AlexCue987
Copy link
Owner

Provide more details when shouldExistInOrder fails, give the number of failing predicate, for example add the following
"Predicate number 1 did not match"

         "fail with clear message" {
             shouldThrowAny {
                listOf(1, 2).shouldExistInOrder(
                   { i: Int -> i < 2 },
                   { i: Int -> i < 2 }
                )
             }.message shouldBe "[1, 2] did not match the predicates [(kotlin.Int) -> kotlin.Boolean, (kotlin.Int) -> kotlin.Boolean] in order. Predicate number 1 did not match."
          }

@AlexCue987 AlexCue987 merged commit 7bf1202 into existInOrder-more-detail Feb 13, 2024
4 checks passed
@AlexCue987 AlexCue987 deleted the existInOrder-draft branch February 13, 2024 19:26
AlexCue987 added a commit that referenced this pull request Feb 25, 2024
provide more details when `shouldExistInOrder` fails. For instance,
print out "Predicate number 1 did not match", as shown in the following
example:
```
        "fail with clear message" {
             shouldThrowAny {
                listOf(1, 2).shouldExistInOrder(
                   { i: Int -> i < 2 },
                   { i: Int -> i < 2 }
                )
             }.message shouldBe "[1, 2] did not match the predicates [(kotlin.Int) -> kotlin.Boolean, (kotlin.Int) -> kotlin.Boolean] in order. Predicate at index 1 did not match."
          }
```

---------

Co-authored-by: Emil Kantis <emil.kantis@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants