Example #1
0
func TestNotDeepEqualStruct(t *testing.T) {
	var c capture
	v := typ{Answer: 42}
	ensure.NotDeepEqual(&c, v, v)
	c.Equal(t, `ensure_test.go:89: expected two different values, but got the same:
(ensure_test.typ) {
 Answer: (int) 42
}`)
}
Example #2
0
func TestUserAgent(t *testing.T) {
	t.Parallel()
	done := make(chan struct{})
	c := &parse.Client{
		Transport: transportFunc(func(r *http.Request) (*http.Response, error) {
			defer close(done)
			ensure.NotDeepEqual(t, r.Header.Get("User-Agent"), "")
			return nil, errors.New("")
		}),
	}
	c.Do(&http.Request{}, nil, nil)
	<-done
}