2020-11-10 16:05:17 +00:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"testing"
|
2021-02-08 04:05:38 +00:00
|
|
|
|
2020-11-10 16:05:17 +00:00
|
|
|
"github.com/sergi/go-diff/diffmatchpatch"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
text1 = "Lorem ipsum dolor."
|
|
|
|
text2 = "Lorem dolor sit amet. sdfsdfsd"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestDiff(t *testing.T) {
|
|
|
|
dmp := diffmatchpatch.New()
|
|
|
|
|
|
|
|
diffs := dmp.DiffMain(text1, text2, false)
|
|
|
|
log.Print(diffs)
|
|
|
|
prettydiff := dmp.DiffPrettyText(diffs)
|
|
|
|
|
|
|
|
log.Print(prettydiff)
|
|
|
|
}
|