| 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 count | 5 package count |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 "testing" | 9 "testing" |
| 10 | 10 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 }) | 92 }) |
| 93 }) | 93 }) |
| 94 | 94 |
| 95 Convey("works for memcache", t, func() { | 95 Convey("works for memcache", t, func() { |
| 96 c, ctr := FilterMC(memory.Use(context.Background())) | 96 c, ctr := FilterMC(memory.Use(context.Background())) |
| 97 So(c, ShouldNotBeNil) | 97 So(c, ShouldNotBeNil) |
| 98 So(ctr, ShouldNotBeNil) | 98 So(ctr, ShouldNotBeNil) |
| 99 mc := memcache.Get(c) | 99 mc := memcache.Get(c) |
| 100 | 100 |
| 101 die(mc.Set(mc.NewItem("hello").SetValue([]byte("sup")))) | 101 die(mc.Set(mc.NewItem("hello").SetValue([]byte("sup")))) |
| 102 » » So(mc.Get(mc.NewItem("Wat")), ShouldNotBeNil) | 102 |
| 103 » » die(mc.Get(mc.NewItem("hello"))) | 103 » » _, err := mc.Get("Wat") |
| 104 » » So(err, ShouldNotBeNil) |
| 105 |
| 106 » » _, err = mc.Get("hello") |
| 107 » » die(err) |
| 104 | 108 |
| 105 So(ctr.SetMulti, shouldHaveSuccessesAndErrors, 1, 0) | 109 So(ctr.SetMulti, shouldHaveSuccessesAndErrors, 1, 0) |
| 106 So(ctr.GetMulti, shouldHaveSuccessesAndErrors, 2, 0) | 110 So(ctr.GetMulti, shouldHaveSuccessesAndErrors, 2, 0) |
| 107 So(ctr.NewItem, shouldHaveSuccessesAndErrors, 3, 0) | 111 So(ctr.NewItem, shouldHaveSuccessesAndErrors, 3, 0) |
| 108 }) | 112 }) |
| 109 | 113 |
| 110 Convey("works for taskqueue", t, func() { | 114 Convey("works for taskqueue", t, func() { |
| 111 c, ctr := FilterTQ(memory.Use(context.Background())) | 115 c, ctr := FilterTQ(memory.Use(context.Background())) |
| 112 So(c, ShouldNotBeNil) | 116 So(c, ShouldNotBeNil) |
| 113 So(ctr, ShouldNotBeNil) | 117 So(ctr, ShouldNotBeNil) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 164 |
| 161 // Using the other function. | 165 // Using the other function. |
| 162 someCalledFunc(c) | 166 someCalledFunc(c) |
| 163 someCalledFunc(c) | 167 someCalledFunc(c) |
| 164 | 168 |
| 165 // Then we can see what happened! | 169 // Then we can see what happened! |
| 166 fmt.Printf("%d\n", counter.PutMulti.Successes()) | 170 fmt.Printf("%d\n", counter.PutMulti.Successes()) |
| 167 // Output: | 171 // Output: |
| 168 // 2 | 172 // 2 |
| 169 } | 173 } |
| OLD | NEW |