diff --git a/go-cheatsheet.md b/go-cheatsheet.md index 2deb17e..9173ab8 100644 --- a/go-cheatsheet.md +++ b/go-cheatsheet.md @@ -2,6 +2,26 @@ ## testing +### use testify + +``` +import "github.com/stretchr/testify/assert" + + +func TestSomething(t *testing.T) { + a := assert.New(t) + + thing, err := functionCall() + + t.Logf("%#v", thing) + + a.NotNil(err) +} +``` + + +### use %#v + ``` go t.Logf("%#v", eim) ```