MCPcopy Create free account
hub / github.com/stretchr/testify / formatListDiff

Function formatListDiff

assert/assertions.go:1158–1176  ·  view source on GitHub ↗
(listA, listB interface{}, extraA, extraB []interface{})

Source from the content-addressed store, hash-verified

1156}
1157
1158func formatListDiff(listA, listB interface{}, extraA, extraB []interface{}) string {
1159 var msg bytes.Buffer
1160
1161 msg.WriteString("elements differ")
1162 if len(extraA) > 0 {
1163 msg.WriteString("\n\nextra elements in list A:\n")
1164 msg.WriteString(spewConfig.Sdump(extraA))
1165 }
1166 if len(extraB) > 0 {
1167 msg.WriteString("\n\nextra elements in list B:\n")
1168 msg.WriteString(spewConfig.Sdump(extraB))
1169 }
1170 msg.WriteString("\n\nlistA:\n")
1171 msg.WriteString(spewConfig.Sdump(listA))
1172 msg.WriteString("\n\nlistB:\n")
1173 msg.WriteString(spewConfig.Sdump(listB))
1174
1175 return msg.String()
1176}
1177
1178// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified
1179// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,

Callers 1

ElementsMatchFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected