field: test CanSet failure

This commit is contained in:
Nathan Perry 2016-06-30 18:53:11 -04:00
parent bfcf7eedca
commit 3ecfced575
No known key found for this signature in database
GPG Key ID: 8AF7F559E74D0672

View File

@ -133,6 +133,20 @@ func TestField_Set(t *testing.T) {
} }
} }
func TestField_NotSettable(t *testing.T) {
a := map[int]Baz{
4: Baz{
A: "value",
},
}
s := New(a[4])
if err := s.Field("A").Set("newValue"); err != errNotSettable {
t.Errorf("Trying to set non-settable field should error with %q. Got %q instead.", errNotSettable, err)
}
}
func TestField_Zero(t *testing.T) { func TestField_Zero(t *testing.T) {
s := newStruct() s := newStruct()