Index: service/datastore/index_test.go |
diff --git a/service/datastore/index_test.go b/service/datastore/index_test.go |
index 6ec9d0953a369a19083f4b131fdf2969cc7624de..c1d47d14a69effed8b20fafb2067b5663c5e2e55 100644 |
--- a/service/datastore/index_test.go |
+++ b/service/datastore/index_test.go |
@@ -7,10 +7,12 @@ |
package datastore |
import ( |
+ "fmt" |
"strings" |
"testing" |
. "github.com/smartystreets/goconvey/convey" |
+ "gopkg.in/yaml.v2" |
) |
var indexDefinitionTests = []struct { |
@@ -80,4 +82,21 @@ func TestIndexDefinition(t *testing.T) { |
}) |
} |
}) |
+ |
+ Convey("Test MarshalYAML/UnmarshalYAML", t, func() { |
+ for _, tc := range indexDefinitionTests { |
+ Convey(fmt.Sprintf("marshallable index definition `%s` is marshalled and unmarshalled correctly", tc.str), func() { |
+ if tc.yaml != nil { |
+ // marshal |
+ _, err := yaml.Marshal(tc.id) |
+ So(err, ShouldBeNil) |
+ |
+ // unmarshal |
+ var ids []*IndexDefinition |
+ yaml.Unmarshal([]byte(strings.Join(tc.yaml, "\n")), &ids) |
+ So(ids[0], ShouldResemble, tc.id) |
+ } |
+ }) |
+ } |
+ }) |
} |