Skip to content

Commit f93fa66

Browse files
committed
ErrorMessagesSpec: make failures easier to read
Old output of `sbt test`: ``` ErrorMessagesSpec: - attr_invalid_switch_inner *** FAILED *** attr_invalid_switch_inner.ksy: /seq/1/size: error: invalid type: expected integer, got CalcBooleanType attr_invalid_switch_inner.ksy: /seq/1/size: error: invalid type: expected integer, got CalcBooleanType did not equal attr_invalid_switch_inner.ksy: /seq/1/size: error: invalid type: expected integer, got CalcBooleanType (SimpleMatchers.scala:34) ``` New output of `sbt test`: ``` ErrorMessagesSpec: - attr_invalid_switch_inner *** FAILED *** [attr_invalid_switch_inner.ksy: /seq/1/size: error: invalid type: expected integer, got CalcBooleanType attr_invalid_switch_inner.ksy: /seq/1/size: error: invalid type: expected integer, got CalcBooleanType ] did not equal [attr_invalid_switch_inner.ksy: /seq/1/size: error: invalid type: expected integer, got CalcBooleanType ] (SimpleMatchers.scala:34) ```
1 parent e31f147 commit f93fa66

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jvm/src/test/scala/io/kaitai/struct/SimpleMatchers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ trait SimpleMatchers {
2929
def shouldEqualPlainly(right: Any)(implicit equality: Equality[T]): Assertion =
3030
if (!equality.areEqual(leftSideValue, right)) {
3131
throw new exceptions.TestFailedException(
32-
(e: exceptions.StackDepthException) => Some(s"""${leftSideValue} did not equal ${right}"""),
32+
(e: exceptions.StackDepthException) => Some(s"""[${leftSideValue}]\n did not equal\n[${right}]"""),
3333
None,
3434
Position.here
3535
)

0 commit comments

Comments
 (0)