I had issues with failure message clarity when usi...
# kotest-contributors
e
I had issues with failure message clarity when using nested inspectors.. Somewhat contrived example..:
Copy code
data class Bar(val x: Int)
            data class Foo(val bars: List<Bar>)
  
            listOf(
                Foo(listOf(Bar(1), Bar(2))),
                Foo(listOf(Bar(1), Bar(3))),
             ).forOne { foo -> 
                foo.bars.forAll {
                   it.x shouldBe 1
                }
             }
Currently fails with the message:
Copy code
0 elements passed but expected 1

The following elements passed:
  --none--

The following elements failed:
  [0] Foo(bars=[Bar(x=1), Bar(x=2)]) => 1 elements passed but expected 2

The following elements passed:
  [0] Bar(x=1)

The following elements failed:
  [1] Bar(x=2) => expected:<1> but was:<2>

  [1] Foo(bars=[Bar(x=1), Bar(x=3)]) => 1 elements passed but expected 2

The following elements passed:
  [0] Bar(x=1)

The following elements failed:
  [1] Bar(x=3) => expected:<1> but was:<3>
I suggest applying indentation much more vigorously to make it clearer how everything relates.
Copy code
0 elements passed but expected 1
  The following elements passed:
    --none--

  The following elements failed:
    [0] Foo(bars=[Bar(x=1), Bar(x=2)]) => 1 elements passed but expected 2
      The following elements passed:
        [0] Bar(x=1)
    
      The following elements failed:
        [1] Bar(x=2) => expected:<1> but was:<2>
    
    [1] Foo(bars=[Bar(x=1), Bar(x=3)]) => 1 elements passed but expected 2
      The following elements passed:
        [0] Bar(x=1)
    
      The following elements failed:
        [1] Bar(x=3) => expected:<1> but was:<3>
Any objections to my suggested change? Otherwise I'll go ahead with a PR
👍🏻 1