-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdiff3_test.go
More file actions
36 lines (31 loc) · 813 Bytes
/
diff3_test.go
File metadata and controls
36 lines (31 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package diff3
import (
"testing"
"github.com/stretchr/testify/assert"
)
type TestCase struct {
textO string
textA string
textB string
expect string
}
var testCases = []TestCase{
{
textO: "Aa\nBb\nCc\n",
textA: "Aa\nBb\nCc\nDd\nEe\nFf\n",
textB: "Aa\nBb\n",
expect: "Aa\nBb\n<<<<<<<\nCc\nDd\nEe\nFf\n=======\n>>>>>>>\n",
},
{
textO: "celery\ngarlic\nonions\nsalmon\ntomatoes\nwine\n",
textA: "celery\nsalmon\ntomatoes\ngarlic\nonions\nwine\n",
textB: "celery\ngarlic\nsalmon\ntomatoes\nonions\nwine\n",
expect: "celery\nsalmon\ntomatoes\ngarlic\n<<<<<<<\nonions\n=======\nsalmon\ntomatoes\nonions\n>>>>>>>\nwine\n",
},
}
func TestMerge(t *testing.T) {
for _, tc := range testCases {
result := Merge(tc.textO, tc.textA, tc.textB)
assert.Equal(t, tc.expect, result)
}
}