spock
spock copied to clipboard
Content of multi-dimensional arrays is not rendered in comparison
def "single arrays are rendered correctly"() {
expect:
isRendered """
x == y
| | |
| | [1, 5]
| false
[2, 5]
""", {
int [] x = [2,5]
int [] y = [1,5]
assert x == y
}
}
def "multi arrays are rendered correctly"() {
expect:
isRendered """
x == y
| | |
| | [[1,2], [1,5]]
| false
[[1,2], [2,5]]
""", {
int [][] x = [[1,2], [2,5]]
int [][] y = [[1,2], [1,5]]
assert x == y
}
}
The second test fails with a rendering of
x == y
| | |
| | [<[I@1e802ef9>, <[I@2b6faea6>]
| false
[<[I@4313f5bc>, <[I@7f010382>]
If nested lists, are used instead of an array it works as expected.
It can be rendered correctly if using def to declare x and y:
def x = [[1,2], [2,5]]
def y = [[1,2], [1,5]]
assert x == y
@lvncnt well those are not arrays, but nested lists.
is there a reason InvokerHelper.toString is not used in the dump()?