()
| 146 | } |
| 147 | |
| 148 | func ExampleGetContextDiffString_fmt() { |
| 149 | a := `one |
| 150 | two |
| 151 | three |
| 152 | four |
| 153 | fmt.Printf("%s,%T",a,b)` |
| 154 | b := `zero |
| 155 | one |
| 156 | tree |
| 157 | four` |
| 158 | diff := ContextDiff{ |
| 159 | A: SplitLines(a), |
| 160 | B: SplitLines(b), |
| 161 | FromFile: "Original", |
| 162 | ToFile: "Current", |
| 163 | Context: 3, |
| 164 | Eol: "\n", |
| 165 | } |
| 166 | result, _ := GetContextDiffString(diff) |
| 167 | fmt.Print(strings.Replace(result, "\t", " ", -1)) |
| 168 | // Output: |
| 169 | // *** Original |
| 170 | // --- Current |
| 171 | // *************** |
| 172 | // *** 1,5 **** |
| 173 | // one |
| 174 | // ! two |
| 175 | // ! three |
| 176 | // four |
| 177 | // - fmt.Printf("%s,%T",a,b) |
| 178 | // --- 1,4 ---- |
| 179 | // + zero |
| 180 | // one |
| 181 | // ! tree |
| 182 | // four |
| 183 | } |
| 184 | |
| 185 | func ExampleGetContextDiffString() { |
| 186 | a := `one |
nothing calls this directly
no test coverage detected