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

Function ExampleGetContextDiffString_second

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

Source from the content-addressed store, hash-verified

173}
174
175func ExampleGetContextDiffString_second() {
176 a := `one
177two
178three
179four`
180 b := `zero
181one
182tree
183four`
184 diff := ContextDiff{
185 A: SplitLines(a),
186 B: SplitLines(b),
187 FromFile: "Original",
188 ToFile: "Current",
189 Context: 3,
190 Eol: "\n",
191 }
192 result, _ := GetContextDiffString(diff)
193 fmt.Printf(strings.Replace(result, "\t", " ", -1))
194 // Output:
195 // *** Original
196 // --- Current
197 // ***************
198 // *** 1,4 ****
199 // one
200 // ! two
201 // ! three
202 // four
203 // --- 1,4 ----
204 // + zero
205 // one
206 // ! tree
207 // four
208}
209
210func rep(s string, count int) string {
211 return strings.Repeat(s, count)

Callers

nothing calls this directly

Calls 3

SplitLinesFunction · 0.85
GetContextDiffStringFunction · 0.85
PrintfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…