Beispiel #1
0
func (s *MarshallerSuite) TestUnmarshalEmptySets(c *gocheck.C) {
	testObj := &TestStruct{}

	attrMap := map[string]*dynamodb.Attribute{}
	attrs := testAttrsWithNilSets()
	for i, _ := range attrs {
		attrMap[attrs[i].Name] = &attrs[i]
	}

	err := dynamodb.UnmarshalAttributes(&attrMap, testObj)
	if err != nil {
		c.Fatalf("Error from dynamodb.UnmarshalAttributes: %#v (Built: %#v)", err, testObj)
	}

	expected := testObjectWithNilSets()
	c.Check(testObj, gocheck.DeepEquals, expected)
}
Beispiel #2
0
func TestUnmarshalEmptySets(t *testing.T) {
	testObj := &TestStruct{}

	attrMap := map[string]*dynamodb.Attribute{}
	attrs := testAttrsWithNilSets()
	for i, _ := range attrs {
		attrMap[attrs[i].Name] = &attrs[i]
	}

	err := dynamodb.UnmarshalAttributes(&attrMap, testObj)
	if err != nil {
		t.Fatalf("Error from dynamodb.UnmarshalAttributes: %#v (Built: %#v)", err, testObj)
	}

	expected := testObjectWithNilSets()
	if fmt.Sprintf("%#v", expected) != fmt.Sprintf("%#v", testObj) {
		t.Errorf("Unexpected result for UnMarshal: was: `%s` but expected: `%s`", fmt.Sprintf("%#v", testObj), fmt.Sprintf("%#v", expected))
	}
}