mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
* Add tests for get-zones * fix CAA, SSHFP, TLSA and other bugs * New format for get-zones: "djs" which is js but uses "disco commas" * Print diffs using github.com/andreyvit/diff Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
29 lines
660 B
Markdown
29 lines
660 B
Markdown
# diff
|
|
|
|
Quick'n'easy string diffing functions for Golang based on [github.com/sergi/go-diff](https://github.com/sergi/go-diff). Mainly for diffing strings in tests.
|
|
|
|
See [the docs on GoDoc](https://godoc.org/github.com/andreyvit/diff).
|
|
|
|
Get it:
|
|
|
|
go get -u github.com/andreyvit/diff
|
|
|
|
Example:
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
"github.com/andreyvit/diff"
|
|
)
|
|
|
|
const expected = `
|
|
...
|
|
`
|
|
|
|
func TestFoo(t *testing.T) {
|
|
actual := Foo(...)
|
|
if a, e := strings.TrimSpace(actual), strings.TrimSpace(expected); a != e {
|
|
t.Errorf("Result not as expected:\n%v", diff.LineDiff(e, a))
|
|
}
|
|
}
|