Exemplo n.º 1
0
func TestMerge(t *testing.T) {

	d := make(map[string]interface{})
	d["name"] = "Mat"

	d1 := make(map[string]interface{})
	d1["name"] = "Tyler"
	d1["location"] = "UT"

	dObj := New(d)
	d1Obj := New(d1)

	merged := dObj.Merge(d1Obj)

	assert.Equal(t, merged.Get("name").Str(), d1Obj.Get("name").Str())
	assert.Equal(t, merged.Get("location").Str(), d1Obj.Get("location").Str())
	assert.Empty(t, dObj.Get("location").Str())

}
Exemplo n.º 2
0
// Empty asserts that the specified object is empty.  I.e. nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
// require.Empty(t, obj)
//
// Returns whether the assertion was successful (true) or not (false).
func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
	if !assert.Empty(t, object, msgAndArgs...) {
		t.FailNow()
	}
}