MCPcopy Create free account
hub / github.com/google/go-cmp / textNode

Interface textNode

cmp/report_text.go:65–92  ·  view source on GitHub ↗

textNode is a simplified tree-based representation of structured text. Possible node types are textWrap, textList, or textLine.

Source from the content-addressed store, hash-verified

63// textNode is a simplified tree-based representation of structured text.
64// Possible node types are textWrap, textList, or textLine.
65type textNode interface {
66 // Len reports the length in bytes of a single-line version of the tree.
67 // Nested textRecord.Diff and textRecord.Comment fields are ignored.
68 Len() int
69 // Equal reports whether the two trees are structurally identical.
70 // Nested textRecord.Diff and textRecord.Comment fields are compared.
71 Equal(textNode) bool
72 // String returns the string representation of the text tree.
73 // It is not guaranteed that len(x.String()) == x.Len(),
74 // nor that x.String() == y.String() implies that x.Equal(y).
75 String() string
76
77 // formatCompactTo formats the contents of the tree as a single-line string
78 // to the provided buffer. Any nested textRecord.Diff and textRecord.Comment
79 // fields are ignored.
80 //
81 // However, not all nodes in the tree should be collapsed as a single-line.
82 // If a node can be collapsed as a single-line, it is replaced by a textLine
83 // node. Since the top-level node cannot replace itself, this also returns
84 // the current node itself.
85 //
86 // This does not mutate the receiver.
87 formatCompactTo([]byte, diffMode) ([]byte, textNode)
88 // formatExpandedTo formats the contents of the tree as a multi-line string
89 // to the provided buffer. In order for column alignment to operate well,
90 // formatCompactTo must be called before calling formatExpandedTo.
91 formatExpandedTo([]byte, diffMode, indentMode) []byte
92}
93
94// textWrap is a wrapper that concatenates a prefix and/or a suffix
95// to the underlying node.

Callers 23

CanFormatDiffSliceMethod · 0.65
FormatDiffSliceMethod · 0.65
formatDiffSliceMethod · 0.65
compareSliceMethod · 0.65
FormatDiffMethod · 0.65
LenMethod · 0.65
LenMethod · 0.65
ExampleOption_equalEmptyFunction · 0.65
FormatDiffSliceMethod · 0.65
EqualFunction · 0.65
DiffFunction · 0.65
callTRFuncMethod · 0.65

Implementers 1

textWrapcmp/report_text.go

Calls

no outgoing calls

Tested by

no test coverage detected