()
| 200 | } |
| 201 | |
| 202 | func ExampleGetContextDiffString() { |
| 203 | a := `one |
| 204 | two |
| 205 | three |
| 206 | four` |
| 207 | b := `zero |
| 208 | one |
| 209 | tree |
| 210 | four` |
| 211 | diff := ContextDiff{ |
| 212 | A: SplitLines([]byte(a)), |
| 213 | B: SplitLines([]byte(b)), |
| 214 | FromFile: "Original", |
| 215 | ToFile: "Current", |
| 216 | Context: 3, |
| 217 | Eol: []byte{'\n'}, |
| 218 | } |
| 219 | result, _ := GetContextDiffString(diff) |
| 220 | fmt.Print(strings.Replace(string(result), "\t", " ", -1)) |
| 221 | // Output: |
| 222 | // *** Original |
| 223 | // --- Current |
| 224 | // *************** |
| 225 | // *** 1,4 **** |
| 226 | // one |
| 227 | // ! two |
| 228 | // ! three |
| 229 | // four |
| 230 | // --- 1,4 ---- |
| 231 | // + zero |
| 232 | // one |
| 233 | // ! tree |
| 234 | // four |
| 235 | } |
| 236 | |
| 237 | func rep(s string, count int) string { |
| 238 | return strings.Repeat(s, count) |
nothing calls this directly
no test coverage detected