Skip to content

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

License

Notifications You must be signed in to change notification settings

katbyte/andreyvit-diff

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 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

Packages

No packages published

Languages

  • Go 100.0%