From 29c38da3497193ab59977e70cb926f62244141a7 Mon Sep 17 00:00:00 2001
From: Cory Bennett <cbennett@netflix.com>
Date: Tue, 18 Jul 2017 16:56:28 -0700
Subject: [PATCH] add test for setting custom types in struct field

---
 core/write_test.go | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/core/write_test.go b/core/write_test.go
index d45f3058..acfae704 100644
--- a/core/write_test.go
+++ b/core/write_test.go
@@ -256,6 +256,10 @@ type testSettable struct {
 	Value string
 }
 
+type testSettableStruct struct {
+	Settable testSettable `survey:"settable"`
+}
+
 func (t *testSettable) WriteAnswer(value interface{}) error {
 	if v, ok := value.(string); ok {
 		t.Value = v
@@ -274,6 +278,11 @@ func TestWriteWithSettable(t *testing.T) {
 	err = WriteAnswer(&testSet2, "prompt", 123)
 	assert.Error(t, fmt.Errorf("Incompatible type int64"), err)
 	assert.Equal(t, "", testSet2.Value)
+
+	testSetStruct := testSettableStruct{}
+	err = WriteAnswer(&testSetStruct, "settable", "stringVal1")
+	assert.Nil(t, err)
+	assert.Equal(t, testSetStruct.Settable.Value, "stringVal1")
 }
 
 type testFieldSettable struct {
@@ -302,7 +311,7 @@ func TestWriteWithFieldSettable(t *testing.T) {
 	assert.Error(t, fmt.Errorf("Incompatible type int64"), err)
 	assert.Equal(t, map[string]string{}, testSet2.Values)
 }
-  
+
 // CONVERSION TESTS
 func TestWrite_canStringToBool(t *testing.T) {
 	// a pointer to hold the boolean value