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

Function ExampleGetContextDiffString_fmt

texteditor/difflib/bytes/bytes_test.go:165–200  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

163}
164
165func ExampleGetContextDiffString_fmt() {
166 a := `one
167two
168three
169four
170fmt.Printf("%s,%T",a,b)`
171 b := `zero
172one
173tree
174four`
175 diff := ContextDiff{
176 A: SplitLines([]byte(a)),
177 B: SplitLines([]byte(b)),
178 FromFile: "Original",
179 ToFile: "Current",
180 Context: 3,
181 Eol: []byte{'\n'},
182 }
183 result, _ := GetContextDiffString(diff)
184 fmt.Print(strings.Replace(string(result), "\t", " ", -1))
185 // Output:
186 // *** Original
187 // --- Current
188 // ***************
189 // *** 1,5 ****
190 // one
191 // ! two
192 // ! three
193 // four
194 // - fmt.Printf("%s,%T",a,b)
195 // --- 1,4 ----
196 // + zero
197 // one
198 // ! tree
199 // four
200}
201
202func ExampleGetContextDiffString() {
203 a := `one

Callers

nothing calls this directly

Calls 3

SplitLinesFunction · 0.70
GetContextDiffStringFunction · 0.70
PrintMethod · 0.45

Tested by

no test coverage detected