mirror of
https://github.com/redis/go-redis.git
synced 2025-07-31 05:04:23 +03:00
Add ParseReq method and tweak benchmarks.
This commit is contained in:
23
parser_test.go
Normal file
23
parser_test.go
Normal file
@ -0,0 +1,23 @@
|
||||
package redis_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/vmihailenco/bufio"
|
||||
. "launchpad.net/gocheck"
|
||||
|
||||
"github.com/vmihailenco/redis"
|
||||
)
|
||||
|
||||
type ParserTest struct{}
|
||||
|
||||
var _ = Suite(&ParserTest{})
|
||||
|
||||
func (t *ParserTest) TestParseReq(c *C) {
|
||||
buf := bytes.NewBufferString("*3\r\n$3\r\nSET\r\n$3\r\nkey\r\n$5\r\nhello\r\n")
|
||||
rd := bufio.NewReaderSize(buf, 1024)
|
||||
|
||||
args, err := redis.ParseReq(rd)
|
||||
c.Check(err, IsNil)
|
||||
c.Check(args, DeepEquals, []string{"SET", "key", "hello"})
|
||||
}
|
Reference in New Issue
Block a user