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