MCPcopy
hub / github.com/google/go-cmp / AppendEllipsis

Method AppendEllipsis

cmp/report_text.go:153–166  ·  view source on GitHub ↗

AppendEllipsis appends a new ellipsis node to the list if none already exists at the end. If cs is non-zero it coalesces the statistics with the previous diffStats.

(ds diffStats)

Source from the content-addressed store, hash-verified

151// exists at the end. If cs is non-zero it coalesces the statistics with the
152// previous diffStats.
153func (s *textList) AppendEllipsis(ds diffStats) {
154 hasStats := !ds.IsZero()
155 if len(*s) == 0 || !(*s)[len(*s)-1].Value.Equal(textEllipsis) {
156 if hasStats {
157 *s = append(*s, textRecord{Value: textEllipsis, ElideComma: true, Comment: ds})
158 } else {
159 *s = append(*s, textRecord{Value: textEllipsis, ElideComma: true})
160 }
161 return
162 }
163 if hasStats {
164 (*s)[len(*s)-1].Comment = (*s)[len(*s)-1].Comment.(diffStats).Append(ds)
165 }
166}
167
168func (s textList) Len() (n int) {
169 for i, r := range s {

Callers 3

formatDiffListMethod · 0.95
FormatValueMethod · 0.95
formatDiffSliceMethod · 0.80

Calls 3

IsZeroMethod · 0.80
AppendMethod · 0.80
EqualMethod · 0.65

Tested by

no test coverage detected