forked from redis/go-redis
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ParseReq method and tweak benchmarks.
- Loading branch information
1 parent
f56748a
commit b6ae953
Showing
5 changed files
with
119 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters