Compare got with other libs #7
ysmood
started this conversation in
Show and tell
Replies: 2 comments
-
got vs testify
The test code to compare got and testifypackage main
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/ysmood/got"
)
var x = map[string]interface{}{
"number": 1 + 1i,
"bytes": []byte{97, 98, 99},
"lines": "multiline string\nline two",
"time": time.Now(),
"json": `{"a" : 1}`,
}
var y = map[string]interface{}{
"number": 1 + 1i,
"bytes": []byte{97, 98, 99},
"lines": "multiline string\nline two",
"time": time.Now(),
"json": `{"a" :1}`,
}
func TestTestify(t *testing.T) {
assert.New(t).Equal(x, y)
}
func TestGot(t *testing.T) {
got.T(t).Eq(x, y)
}Output of testifyOutput of got |
Beta Was this translation helpful? Give feedback.
0 replies
-
got vs go-cmppackage main
import (
"testing"
"github.com/google/go-cmp/cmp"
"github.com/ysmood/got"
)
var x = "test"
var y = "text"
func Test_go_cmp(t *testing.T) {
if df := cmp.Diff(x, y); df != "" {
t.Errorf(df)
}
}
func Test_got(t *testing.T) {
got.T(t).Eq(x, y)
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment



Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
got vs testify
got vs go-cmp
Beta Was this translation helpful? Give feedback.
All reactions