]>
git.saurik.com Git - redis.git/blob - tests/unit/protocol.tcl
1 start_server
{tags
{"protocol"}} {
2 test
"Handle an empty query" {
6 assert_equal
"PONG" [r ping
]
9 test
"Negative multibulk length" {
13 assert_equal PONG
[r ping
]
16 test
"Out of range multibulk length" {
18 r write
"*20000000\r\n"
20 assert_error
"*invalid multibulk length*" {r
read}
23 test
"Wrong multibulk payload header" {
25 r write
"*3\r\n\$3\r\nSET\r\n\$1\r\nx\r\nfooz\r\n"
27 assert_error
"*expected '$', got 'f'*" {r
read}
30 test
"Negative multibulk payload length" {
32 r write
"*3\r\n\$3\r\nSET\r\n\$1\r\nx\r\n\$-10\r\n"
34 assert_error
"*invalid bulk length*" {r
read}
37 test
"Out of range multibulk payload length" {
39 r write
"*3\r\n\$3\r\nSET\r\n\$1\r\nx\r\n\$2000000000\r\n"
41 assert_error
"*invalid bulk length*" {r
read}
44 test
"Non-number multibulk payload length" {
46 r write
"*3\r\n\$3\r\nSET\r\n\$1\r\nx\r\n\$blabla\r\n"
48 assert_error
"*invalid bulk length*" {r
read}
51 test
"Multi bulk request not followed by bulk arguments" {
53 r write
"*1\r\nfoo\r\n"
55 assert_error
"*expected '$', got 'f'*" {r
read}
58 test
"Generic wrong number of args" {
60 assert_error
"*wrong*arguments*ping*" {r ping x y z
}
64 start_server
{tags
{"regression"}} {
65 test
"Regression for a crash with blocking ops and pipelining" {
66 set rd
[redis_deferring_client
]
68 set proto
"*3\r\n\$5\r\nBLPOP\r\n\$6\r\nnolist\r\n\$1\r\n0\r\n"
69 puts -nonewline $fd $proto$proto