OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package serialize | 5 package serialize |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "fmt" | 9 "fmt" |
10 "io" | 10 "io" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 buf := mkBuf(nil) | 157 buf := mkBuf(nil) |
158 cmpbin.WriteString(buf, "foo") | 158 cmpbin.WriteString(buf, "foo") |
159 buf.WriteByte(byte(ds.PTInt)) | 159 buf.WriteByte(byte(ds.PTInt)) |
160 cmpbin.WriteInt(buf, 20) | 160 cmpbin.WriteInt(buf, 20) |
161 So(string(ToBytes(ds.KeyTok{Kind: "foo", IntID: 20})), | 161 So(string(ToBytes(ds.KeyTok{Kind: "foo", IntID: 20})), |
162 ShouldEqual, buf.String()) | 162 ShouldEqual, buf.String()) |
163 }) | 163 }) |
164 | 164 |
165 Convey("Property", func() { | 165 Convey("Property", func() { |
166 buf := mkBuf(nil) | 166 buf := mkBuf(nil) |
167 » » » buf.WriteByte(byte(ds.PTString)) | 167 » » » buf.WriteByte(0x80 | byte(ds.PTString)) |
168 cmpbin.WriteString(buf, "nerp") | 168 cmpbin.WriteString(buf, "nerp") |
169 So(string(ToBytes(mp("nerp"))), | 169 So(string(ToBytes(mp("nerp"))), |
170 ShouldEqual, buf.String()) | 170 ShouldEqual, buf.String()) |
171 }) | 171 }) |
172 | 172 |
173 Convey("Time", func() { | 173 Convey("Time", func() { |
174 tp := mp(time.Now().UTC()) | 174 tp := mp(time.Now().UTC()) |
175 So(string(ToBytes(tp.Value())), ShouldEqual, string(ToBy
tes(tp)[1:])) | 175 So(string(ToBytes(tp.Value())), ShouldEqual, string(ToBy
tes(tp)[1:])) |
176 }) | 176 }) |
177 | 177 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 for i := 0; i < MaxIndexColumns+1; i++ { | 450 for i := 0; i < MaxIndexColumns+1; i++ { |
451 id.SortBy = append(id.SortBy, ds.IndexCo
lumn{Property: "Hi", Direction: ds.ASCENDING}) | 451 id.SortBy = append(id.SortBy, ds.IndexCo
lumn{Property: "Hi", Direction: ds.ASCENDING}) |
452 } | 452 } |
453 data := ToBytes(id) | 453 data := ToBytes(id) |
454 newID, err = ReadIndexDefinition(mkBuf(data)) | 454 newID, err = ReadIndexDefinition(mkBuf(data)) |
455 So(err, ShouldErrLike, "over 64 sort orders") | 455 So(err, ShouldErrLike, "over 64 sort orders") |
456 }) | 456 }) |
457 }) | 457 }) |
458 }) | 458 }) |
459 } | 459 } |
OLD | NEW |