()
| 163 | } |
| 164 | |
| 165 | func ExampleGetContextDiffString_fmt() { |
| 166 | a := `one |
| 167 | two |
| 168 | three |
| 169 | four |
| 170 | fmt.Printf("%s,%T",a,b)` |
| 171 | b := `zero |
| 172 | one |
| 173 | tree |
| 174 | four` |
| 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 | |
| 202 | func ExampleGetContextDiffString() { |
| 203 | a := `one |
nothing calls this directly
no test coverage detected