Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: service/datastore/index_test.go

Issue 1574353004: GitHub #8: Seed indexes from index.yml (Closed) Base URL: https://github.com/luci/gae@master
Patch Set: path argument in FindAndParseIndexYAML, add a couple of tests Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « service/datastore/index.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
+ }
+ })
+ }
+ })
}
« no previous file with comments | « service/datastore/index.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698