MCPcopy Index your code
hub / github.com/expr-lang/expr / ExampleGetContextDiffString

Function ExampleGetContextDiffString

internal/difflib/difflib_test.go:138–173  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

136}
137
138func ExampleGetContextDiffString() {
139 a := `one
140two
141three
142four
143fmt.Printf("%s,%T",a,b)`
144 b := `zero
145one
146tree
147four`
148 diff := ContextDiff{
149 A: SplitLines(a),
150 B: SplitLines(b),
151 FromFile: "Original",
152 ToFile: "Current",
153 Context: 3,
154 Eol: "\n",
155 }
156 result, _ := GetContextDiffString(diff)
157 fmt.Print(strings.Replace(result, "\t", " ", -1))
158 // Output:
159 // *** Original
160 // --- Current
161 // ***************
162 // *** 1,5 ****
163 // one
164 // ! two
165 // ! three
166 // four
167 // - fmt.Printf("%s,%T",a,b)
168 // --- 1,4 ----
169 // + zero
170 // one
171 // ! tree
172 // four
173}
174
175func ExampleGetContextDiffString_second() {
176 a := `one

Callers

nothing calls this directly

Calls 3

SplitLinesFunction · 0.85
GetContextDiffStringFunction · 0.85
PrintMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…