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

Function TestPatchToText

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

Source from the content-addressed store, hash-verified

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