()
| 136 | } |
| 137 | |
| 138 | func ExampleGetContextDiffString() { |
| 139 | a := `one |
| 140 | two |
| 141 | three |
| 142 | four |
| 143 | fmt.Printf("%s,%T",a,b)` |
| 144 | b := `zero |
| 145 | one |
| 146 | tree |
| 147 | four` |
| 148 | diff := ContextDiff{ |
| 149 | A: SplitLines(a), |
| 150 | B: SplitLines(b), |
| 151 | FromFile: "Original", |
| 152 | ToFile: "Current", |
| 153 | Context: 3, |
| 154 | Eol: "\n", |
| 155 | } |
| 156 | result, _ := GetContextDiffString(diff) |
| 157 | fmt.Print(strings.Replace(result, "\t", " ", -1)) |
| 158 | // Output: |
| 159 | // *** Original |
| 160 | // --- Current |
| 161 | // *************** |
| 162 | // *** 1,5 **** |
| 163 | // one |
| 164 | // ! two |
| 165 | // ! three |
| 166 | // four |
| 167 | // - fmt.Printf("%s,%T",a,b) |
| 168 | // --- 1,4 ---- |
| 169 | // + zero |
| 170 | // one |
| 171 | // ! tree |
| 172 | // four |
| 173 | } |
| 174 | |
| 175 | func ExampleGetContextDiffString_second() { |
| 176 | a := `one |
nothing calls this directly
no test coverage detected
searching dependent graphs…