Skip to content

show only the first 5 additional elements for inOrderOnly and inAnyOrderOnly #1100

@robstoll

Description

@robstoll

Platform (all, jvm, js): all
Extension (none, kotlin 1.3): none

Code related feature

expect((1..100).toList()).toContainExactly(1,2,3)

The output will show all additional elements from 4 to 100 which is way too verbose. Similar to the showOnlyFailing option which controls reporting of the expected elements we should introduce a setMaxNumberOfAdditionalElements for inOrder.only and setMaxNumberOfMismatchesAndAdditionalElements for inAnyOrder.only which both default to 5

In the end I expect something like:

I expected subject: [1,2,3,....]
◆ ▶ size: 100        (kotlin.Int <1967062238>)
    ◾ to equal: 3        (kotlin.Int <1807366782>)
◆ to contain only, in any order: 
  ✔ an element which equals: 1
  ✔ an element which equals: 2
  ✘ an element which equals: 3
  ❗❗ mismatches and additional elements detected: 
     ⚬ 0
     ⚬ 4
     ⚬ 5
     ⚬ 6
     ⚬ 7
     ⚬ ... (92 elements not shown)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions