()
| 115 | } |
| 116 | |
| 117 | func ExampleGetUnifiedDiffString() { |
| 118 | a := `one |
| 119 | two |
| 120 | three |
| 121 | four |
| 122 | fmt.Printf("%s,%T",a,b)` |
| 123 | b := `zero |
| 124 | one |
| 125 | three |
| 126 | four` |
| 127 | diff := UnifiedDiff{ |
| 128 | A: SplitLines(a), |
| 129 | B: SplitLines(b), |
| 130 | FromFile: "Original", |
| 131 | FromDate: "2005-01-26 23:30:50", |
| 132 | ToFile: "Current", |
| 133 | ToDate: "2010-04-02 10:20:52", |
| 134 | Context: 3, |
| 135 | } |
| 136 | result, _ := GetUnifiedDiffString(diff) |
| 137 | fmt.Println(strings.ReplaceAll(result, "\t", " ")) |
| 138 | // Output: |
| 139 | // --- Original 2005-01-26 23:30:50 |
| 140 | // +++ Current 2010-04-02 10:20:52 |
| 141 | // @@ -1,5 +1,4 @@ |
| 142 | // +zero |
| 143 | // one |
| 144 | // -two |
| 145 | // three |
| 146 | // four |
| 147 | // -fmt.Printf("%s,%T",a,b) |
| 148 | } |
| 149 | |
| 150 | func rep(s string, count int) string { |
| 151 | return strings.Repeat(s, count) |
nothing calls this directly
no test coverage detected