Skip to content
/ diff Public

Quick'n'easy string diffs for Golang, mainly for diffing strings in tests

License

Notifications You must be signed in to change notification settings

andreyvit/diff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

diff

Quick'n'easy string diffing functions for Golang based on github.com/sergi/go-diff. Mainly for diffing strings in tests.

See the docs on GoDoc.

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))
    }
}

About

Quick'n'easy string diffs for Golang, mainly for diffing strings in tests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages