Commit 8996bc7c authored by Kyle Lemons's avatar Kyle Lemons

Add Diff example

parent b3453e10
package diff
import (
"fmt"
"reflect"
"strings"
"testing"
)
......@@ -72,3 +74,31 @@ func TestDiff(t *testing.T) {
}
}
}
func ExampleDiff() {
constitution := strings.TrimSpace(`
We the People of the United States, in Order to form a more perfect Union,
establish Justice, insure domestic Tranquility, provide for the common defence,
promote the general Welfare, and secure the Blessings of Liberty to ourselves
and our Posterity, do ordain and establish this Constitution for the United
States of America.
`)
got := strings.TrimSpace(`
We the People of the United States, in Order to form a more perfect Union,
establish Justice, insure domestic Tranquility, provide for the common defence,
and secure the Blessings of Liberty to ourselves
and our Posterity, do ordain and establish this Constitution for the United
States of America.
`)
fmt.Println(Diff(got, constitution))
// Output:
// We the People of the United States, in Order to form a more perfect Union,
// establish Justice, insure domestic Tranquility, provide for the common defence,
// -and secure the Blessings of Liberty to ourselves
// +promote the general Welfare, and secure the Blessings of Liberty to ourselves
// and our Posterity, do ordain and establish this Constitution for the United
// States of America.
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment