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

Unified Diff: service/datastore/serialize/serialize_test.go

Issue 1286093007: Fix key encoding to be null terminated (Closed) Base URL: https://github.com/luci/gae.git@add_iterator
Patch Set: Set limit to > instead of >= Created 5 years, 4 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/serialize/serialize.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/serialize/serialize_test.go
diff --git a/service/datastore/serialize/serialize_test.go b/service/datastore/serialize/serialize_test.go
index b1fced4d335b6ad19ac616988f32b96252fb28d7..168eb7344e5ab94b16f9c17f04ba2dfd80711241 100644
--- a/service/datastore/serialize/serialize_test.go
+++ b/service/datastore/serialize/serialize_test.go
@@ -256,7 +256,11 @@ func TestSerializationReadMisc(t *testing.T) {
buf.WriteByte(1) // actualCtx == 1
cmpbin.WriteString(buf, "aid")
cmpbin.WriteString(buf, "ns")
- cmpbin.WriteUint(buf, 1000)
+ for i := 1; i < 60; i++ {
+ buf.WriteByte(1)
+ WriteKeyTok(buf, ds.KeyTok{Kind: "sup", IntID: int64(i)})
+ }
+ buf.WriteByte(0)
_, err := ReadKey(buf, WithContext, "", "")
So(err, ShouldErrLike, "huge key")
})
@@ -272,7 +276,7 @@ func TestSerializationReadMisc(t *testing.T) {
buf.WriteByte(1) // actualCtx == 1
cmpbin.WriteString(buf, "aid")
cmpbin.WriteString(buf, "ns")
- cmpbin.WriteUint(buf, 2)
+ buf.WriteByte(1)
cmpbin.WriteString(buf, "hi")
_, err := ReadKey(buf, WithContext, "", "")
So(err, ShouldEqual, io.EOF)
@@ -281,7 +285,7 @@ func TestSerializationReadMisc(t *testing.T) {
buf.WriteByte(1) // actualCtx == 1
cmpbin.WriteString(buf, "aid")
cmpbin.WriteString(buf, "ns")
- cmpbin.WriteUint(buf, 2)
+ buf.WriteByte(1)
cmpbin.WriteString(buf, "hi")
buf.WriteByte(byte(ds.PTString))
_, err := ReadKey(buf, WithContext, "", "")
@@ -291,7 +295,7 @@ func TestSerializationReadMisc(t *testing.T) {
buf.WriteByte(1) // actualCtx == 1
cmpbin.WriteString(buf, "aid")
cmpbin.WriteString(buf, "ns")
- cmpbin.WriteUint(buf, 2)
+ buf.WriteByte(1)
cmpbin.WriteString(buf, "hi")
buf.WriteByte(byte(ds.PTBlobKey))
_, err := ReadKey(buf, WithContext, "", "")
@@ -301,7 +305,7 @@ func TestSerializationReadMisc(t *testing.T) {
buf.WriteByte(1) // actualCtx == 1
cmpbin.WriteString(buf, "aid")
cmpbin.WriteString(buf, "ns")
- cmpbin.WriteUint(buf, 2)
+ buf.WriteByte(1)
cmpbin.WriteString(buf, "hi")
buf.WriteByte(byte(ds.PTInt))
cmpbin.WriteInt(buf, -2)
« no previous file with comments | « service/datastore/serialize/serialize.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698