MCPcopy Index your code
hub / github.com/expr-lang/expr / ExampleGetUnifiedDiffString

Function ExampleGetUnifiedDiffString

internal/difflib/difflib_test.go:105–136  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

103}
104
105func ExampleGetUnifiedDiffString() {
106 a := `one
107two
108three
109four
110fmt.Printf("%s,%T",a,b)`
111 b := `zero
112one
113three
114four`
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
138func ExampleGetContextDiffString() {
139 a := `one

Callers

nothing calls this directly

Calls 3

SplitLinesFunction · 0.85
GetUnifiedDiffStringFunction · 0.85
PrintlnMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…