MCPcopy Create free account
hub / github.com/cogentcore/core / ExampleGetContextDiffString_fmt

Function ExampleGetContextDiffString_fmt

texteditor/difflib/difflib_test.go:148–183  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

146}
147
148func ExampleGetContextDiffString_fmt() {
149 a := `one
150two
151three
152four
153fmt.Printf("%s,%T",a,b)`
154 b := `zero
155one
156tree
157four`
158 diff := ContextDiff{
159 A: SplitLines(a),
160 B: SplitLines(b),
161 FromFile: "Original",
162 ToFile: "Current",
163 Context: 3,
164 Eol: "\n",
165 }
166 result, _ := GetContextDiffString(diff)
167 fmt.Print(strings.Replace(result, "\t", " ", -1))
168 // Output:
169 // *** Original
170 // --- Current
171 // ***************
172 // *** 1,5 ****
173 // one
174 // ! two
175 // ! three
176 // four
177 // - fmt.Printf("%s,%T",a,b)
178 // --- 1,4 ----
179 // + zero
180 // one
181 // ! tree
182 // four
183}
184
185func ExampleGetContextDiffString() {
186 a := `one

Callers

nothing calls this directly

Calls 3

SplitLinesFunction · 0.70
GetContextDiffStringFunction · 0.70
PrintMethod · 0.45

Tested by

no test coverage detected