xref: /redis-3.2.3/tests/unit/protocol.tcl (revision 9e5d2e8b)
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 {Multi bulk request not followed by bulk args} {
31        set fd [r channel]
32        puts -nonewline $fd "*1\r\nfoo\r\n"
33        flush $fd
34        gets $fd
35    } {*protocol error*}
36
37    test {Generic wrong number of args} {
38        catch {r ping x y z} err
39        set _ $err
40    } {*wrong*arguments*ping*}
41}
42