File tree Expand file tree Collapse file tree 1 file changed +6
-17
lines changed
jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts Expand file tree Collapse file tree 1 file changed +6
-17
lines changed Original file line number Diff line number Diff line change @@ -48,23 +48,12 @@ object SnapshotNotEqualErrorMsg {
4848
4949 if (endOfLineActual == endOfLineExpected) {
5050 // it ended at a line break
51- if (actual.length > expected.length) {
52- val line =
53- actual.let { str ->
54- val endIdx =
55- str.indexOf(' \n ' , endOfLineActual + 1 ).let { if (it == - 1 ) str.length else it }
56- str.substring(endOfLineActual + 1 , endIdx)
57- }
58- return " Snapshot mismatch at L${lineNumber+ 1 } :C1 - line(s) added\n +$line "
59- } else {
60- val line =
61- expected.let { str ->
62- val endIdx =
63- str.indexOf(' \n ' , endOfLineActual + 1 ).let { if (it == - 1 ) str.length else it }
64- str.substring(endOfLineActual + 1 , endIdx)
65- }
66- return " Snapshot mismatch at L${lineNumber+ 1 } :C1 - line(s) removed\n -$line "
67- }
51+ val longer = if (actual.length > expected.length) actual else expected
52+ val added = if (actual.length > expected.length) " +" else " -"
53+ val endIdx =
54+ longer.indexOf(' \n ' , endOfLineActual + 1 ).let { if (it == - 1 ) longer.length else it }
55+ val line = longer.substring(endOfLineActual + 1 , endIdx)
56+ return " Snapshot mismatch at L${lineNumber+ 1 } :C1 - line(s) ${if (added == " +" ) " added" else " removed" } \n ${added}$line "
6857 } else {
6958 val expectedLine = expected.substring(index - columnNumber + 1 , endOfLineExpected)
7059 val actualLine = actual.substring(index - columnNumber + 1 , endOfLineActual)
You can’t perform that action at this time.
0 commit comments