MCPcopy Create free account
hub / github.com/sergi/go-diff / TestPatchToText

Function TestPatchToText

diffmatchpatch/patch_test.go:102–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

100}
101
102func TestPatchToText(t *testing.T) {
103 type TestCase struct {
104 Patch string
105 }
106
107 dmp := New()
108
109 for i, tc := range []TestCase{
110 {"@@ -21,18 +22,17 @@\n jump\n-s\n+ed\n over \n-the\n+a\n laz\n"},
111 {"@@ -1,9 +1,9 @@\n-f\n+F\n oo+fooba\n@@ -7,9 +7,9 @@\n obar\n-,\n+.\n tes\n"},
112 } {
113 patches, err := dmp.PatchFromText(tc.Patch)
114 assert.Nil(t, err)
115
116 actual := dmp.PatchToText(patches)
117 assert.Equal(t, tc.Patch, actual, fmt.Sprintf("Test case #%d, %#v", i, tc))
118 }
119}
120
121func TestPatchAddContext(t *testing.T) {
122 type TestCase struct {

Callers

nothing calls this directly

Calls 3

NewFunction · 0.85
PatchFromTextMethod · 0.80
PatchToTextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…