File tree Expand file tree Collapse file tree 2 files changed +12
-30
lines changed Expand file tree Collapse file tree 2 files changed +12
-30
lines changed Original file line number Diff line number Diff line change 1
1
package proto_test
2
2
3
3
import (
4
- "context"
5
4
"encoding/json"
6
- "errors"
7
- "testing"
8
- "time"
9
5
10
- "github.com/go-redis/redis/v8"
11
6
"github.com/go-redis/redis/v8/internal/proto"
12
7
. "github.com/onsi/ginkgo"
13
8
. "github.com/onsi/gomega"
@@ -52,28 +47,3 @@ var _ = Describe("ScanSlice", func() {
52
47
}))
53
48
})
54
49
})
55
-
56
- func TestScan (t * testing.T ) {
57
- t .Parallel ()
58
-
59
- t .Run ("time" , func (t * testing.T ) {
60
- t .Parallel ()
61
-
62
- ctx := context .Background ()
63
-
64
- rdb := redis .NewClient (& redis.Options {
65
- Addr : ":6379" ,
66
- })
67
-
68
- tm := time .Now ()
69
- rdb .Set (ctx , "now" , tm , 0 )
70
-
71
- var tm2 time.Time
72
- rdb .Get (ctx , "now" ).Scan (& tm2 )
73
-
74
- if ! tm2 .Equal (tm ) {
75
- t .Fatal (errors .New ("tm2 and tm are not equal" ))
76
- }
77
- })
78
-
79
- }
Original file line number Diff line number Diff line change @@ -283,6 +283,18 @@ var _ = Describe("Client", func() {
283
283
Expect (err ).NotTo (HaveOccurred ())
284
284
Expect (got ).To (Equal (bigVal ))
285
285
})
286
+
287
+ It ("should set and scan time" , func () {
288
+ tm := time .Now ()
289
+ err := rdb .Set (ctx , "now" , tm , 0 ).Err ()
290
+ Expect (err ).NotTo (HaveOccurred ())
291
+
292
+ var tm2 time.Time
293
+ err = rdb .Get (ctx , "now" ).Scan (& tm2 )
294
+ Expect (err ).NotTo (HaveOccurred ())
295
+
296
+ Expect (tm2 ).To (BeTemporally ("==" , tm ))
297
+ })
286
298
})
287
299
288
300
var _ = Describe ("Client timeout" , func () {
You can’t perform that action at this time.
0 commit comments