xref: /redis-3.2.3/tests/unit/protocol.tcl (revision 01daeece)
1start_server {} {
2    test {Handle an empty query well} {
3        set fd [r channel]
4        puts -nonewline $fd "\r\n"
5        flush $fd
6        r ping
7    } {PONG}
8
9    test {Negative multi bulk command does not create problems} {
10        set fd [r channel]
11        puts -nonewline $fd "*-10\r\n"
12        flush $fd
13        r ping
14    } {PONG}
15
16    test {Negative multi bulk payload} {
17        set fd [r channel]
18        puts -nonewline $fd "SET x -10\r\n"
19        flush $fd
20        gets $fd
21    } {*invalid bulk*}
22
23    test {Too big bulk payload} {
24        set fd [r channel]
25        puts -nonewline $fd "SET x 2000000000\r\n"
26        flush $fd
27        gets $fd
28    } {*invalid bulk*count*}
29
30    test {bulk payload is not a number} {
31        set fd [r channel]
32        puts -nonewline $fd "SET x blabla\r\n"
33        flush $fd
34        gets $fd
35    } {*invalid bulk*count*}
36
37    test {Multi bulk request not followed by bulk args} {
38        set fd [r channel]
39        puts -nonewline $fd "*1\r\nfoo\r\n"
40        flush $fd
41        gets $fd
42    } {*protocol error*}
43
44    test {Generic wrong number of args} {
45        catch {r ping x y z} err
46        set _ $err
47    } {*wrong*arguments*ping*}
48}
49