mirror of
https://github.com/redis/go-redis.git
synced 2025-07-31 05:04:23 +03:00
feat: add WriteArg and Scan net.IP(#2062)
* feat: add WriteArg net.IP * feat: add Scan net.IP
This commit is contained in:
@ -3,6 +3,8 @@ package proto_test
|
||||
import (
|
||||
"bytes"
|
||||
"encoding"
|
||||
"fmt"
|
||||
"net"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -64,6 +66,13 @@ var _ = Describe("WriteBuffer", func() {
|
||||
|
||||
Expect(buf.Len()).To(Equal(15))
|
||||
})
|
||||
|
||||
It("should append net.IP", func() {
|
||||
ip := net.ParseIP("192.168.1.1")
|
||||
err := wr.WriteArgs([]interface{}{ip})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(buf.String()).To(Equal(fmt.Sprintf("*1\r\n$16\r\n%s\r\n", bytes.NewBuffer(ip))))
|
||||
})
|
||||
})
|
||||
|
||||
type discard struct{}
|
||||
|
Reference in New Issue
Block a user