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

Side by Side Diff: impl/memory/memcache_test.go

Issue 1541183002: Make setting a Memcache Item with a nil Value OK (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: Created 4 years, 12 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 unified diff | Download patch
« no previous file with comments | « no previous file | impl/prod/everything_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 memory 5 package memory
6 6
7 import ( 7 import (
8 "testing" 8 "testing"
9 "time" 9 "time"
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 So(err, ShouldBeNil) 100 So(err, ShouldBeNil)
101 So(getItm, ShouldResemble, testItem) 101 So(getItm, ShouldResemble, testItem)
102 102
103 Convey("Flush works too", func() { 103 Convey("Flush works too", func() {
104 So(mc.Flush(), ShouldBeNil) 104 So(mc.Flush(), ShouldBeNil)
105 _, err := mc.Get("sup") 105 _, err := mc.Get("sup")
106 So(err, ShouldEqual, mcS.ErrCacheMiss) 106 So(err, ShouldEqual, mcS.ErrCacheMiss)
107 }) 107 })
108 }) 108 })
109 109
110 Convey("Set (nil) is equivalent to Set([]byte{})", func( ) {
111 So(mc.Set(mc.NewItem("bob")), ShouldBeNil)
112
113 bob, err := mc.Get("bob")
114 So(err, ShouldBeNil)
115 So(bob.Value(), ShouldResemble, []byte{})
116 })
117
110 Convey("Increment", func() { 118 Convey("Increment", func() {
111 val, err := mc.Increment("num", 7, 2) 119 val, err := mc.Increment("num", 7, 2)
112 So(err, ShouldBeNil) 120 So(err, ShouldBeNil)
113 So(val, ShouldEqual, 9) 121 So(val, ShouldEqual, 9)
114 122
115 Convey("IncrementExisting", func() { 123 Convey("IncrementExisting", func() {
116 val, err := mc.IncrementExisting("num", -2) 124 val, err := mc.IncrementExisting("num", -2)
117 So(err, ShouldBeNil) 125 So(err, ShouldBeNil)
118 So(val, ShouldEqual, 7) 126 So(val, ShouldEqual, 7)
119 127
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 testItem := &mcItem{ 208 testItem := &mcItem{
201 key: "sup", 209 key: "sup",
202 value: []byte("cool"), 210 value: []byte("cool"),
203 CasID: 1, 211 CasID: 1,
204 } 212 }
205 So(getItm, ShouldResemble, testItem) 213 So(getItm, ShouldResemble, testItem)
206 }) 214 })
207 215
208 }) 216 })
209 } 217 }
OLDNEW
« no previous file with comments | « no previous file | impl/prod/everything_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698