()
| 130 | } |
| 131 | |
| 132 | func ExampleGetUnifiedDiffString() { |
| 133 | a := `one |
| 134 | two |
| 135 | three |
| 136 | four |
| 137 | fmt.Printf("%s,%T",a,b)` |
| 138 | b := `zero |
| 139 | one |
| 140 | three |
| 141 | four` |
| 142 | diff := UnifiedDiff{ |
| 143 | A: SplitLines([]byte(a)), |
| 144 | B: SplitLines([]byte(b)), |
| 145 | FromFile: "Original", |
| 146 | FromDate: "2005-01-26 23:30:50", |
| 147 | ToFile: "Current", |
| 148 | ToDate: "2010-04-02 10:20:52", |
| 149 | Context: 3, |
| 150 | } |
| 151 | result, _ := GetUnifiedDiffString(diff) |
| 152 | fmt.Println(strings.Replace(string(result), "\t", " ", -1)) |
| 153 | // Output: |
| 154 | // --- Original 2005-01-26 23:30:50 |
| 155 | // +++ Current 2010-04-02 10:20:52 |
| 156 | // @@ -1,5 +1,4 @@ |
| 157 | // +zero |
| 158 | // one |
| 159 | // -two |
| 160 | // three |
| 161 | // four |
| 162 | // -fmt.Printf("%s,%T",a,b) |
| 163 | } |
| 164 | |
| 165 | func ExampleGetContextDiffString_fmt() { |
| 166 | a := `one |
nothing calls this directly
no test coverage detected