()
| 183 | } |
| 184 | |
| 185 | func ExampleGetContextDiffString() { |
| 186 | a := `one |
| 187 | two |
| 188 | three |
| 189 | four` |
| 190 | b := `zero |
| 191 | one |
| 192 | tree |
| 193 | four` |
| 194 | diff := ContextDiff{ |
| 195 | A: SplitLines(a), |
| 196 | B: SplitLines(b), |
| 197 | FromFile: "Original", |
| 198 | ToFile: "Current", |
| 199 | Context: 3, |
| 200 | Eol: "\n", |
| 201 | } |
| 202 | result, _ := GetContextDiffString(diff) |
| 203 | fmt.Print(strings.Replace(result, "\t", " ", -1)) |
| 204 | // Output: |
| 205 | // *** Original |
| 206 | // --- Current |
| 207 | // *************** |
| 208 | // *** 1,4 **** |
| 209 | // one |
| 210 | // ! two |
| 211 | // ! three |
| 212 | // four |
| 213 | // --- 1,4 ---- |
| 214 | // + zero |
| 215 | // one |
| 216 | // ! tree |
| 217 | // four |
| 218 | } |
| 219 | |
| 220 | func rep(s string, count int) string { |
| 221 | return strings.Repeat(s, count) |
nothing calls this directly
no test coverage detected