()
| 103 | } |
| 104 | |
| 105 | func ExampleGetUnifiedDiffString() { |
| 106 | a := `one |
| 107 | two |
| 108 | three |
| 109 | four |
| 110 | fmt.Printf("%s,%T",a,b)` |
| 111 | b := `zero |
| 112 | one |
| 113 | three |
| 114 | four` |
| 115 | diff := UnifiedDiff{ |
| 116 | A: SplitLines(a), |
| 117 | B: SplitLines(b), |
| 118 | FromFile: "Original", |
| 119 | FromDate: "2005-01-26 23:30:50", |
| 120 | ToFile: "Current", |
| 121 | ToDate: "2010-04-02 10:20:52", |
| 122 | Context: 3, |
| 123 | } |
| 124 | result, _ := GetUnifiedDiffString(diff) |
| 125 | fmt.Println(strings.Replace(result, "\t", " ", -1)) |
| 126 | // Output: |
| 127 | // --- Original 2005-01-26 23:30:50 |
| 128 | // +++ Current 2010-04-02 10:20:52 |
| 129 | // @@ -1,5 +1,4 @@ |
| 130 | // +zero |
| 131 | // one |
| 132 | // -two |
| 133 | // three |
| 134 | // four |
| 135 | // -fmt.Printf("%s,%T",a,b) |
| 136 | } |
| 137 | |
| 138 | func ExampleGetContextDiffString() { |
| 139 | a := `one |
nothing calls this directly
no test coverage detected
searching dependent graphs…