| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Protocol::Redis::Test; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
83105
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
35
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
59
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Exporter; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
9
|
|
|
|
|
|
|
our @EXPORT = qw(protocol_redis_ok); |
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use Test::More; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
12
|
|
|
|
|
|
|
require Carp; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub protocol_redis_ok($$) { |
|
15
|
1
|
|
|
1
|
1
|
89
|
my ($redis_class, $api_version) = @_; |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
50
|
|
|
|
4
|
if ($api_version == 1) { |
|
18
|
1
|
|
|
|
|
4
|
_apiv1_ok($redis_class); |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
else { |
|
21
|
0
|
|
|
|
|
0
|
Carp::croak(qq/Unknown Protocol::Redis API version $api_version/); |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _apiv1_ok { |
|
26
|
1
|
|
|
1
|
|
3
|
my $redis_class = shift; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
subtest 'Protocol::Redis APIv1 ok' => sub { |
|
29
|
1
|
|
|
1
|
|
1206
|
plan tests => 43; |
|
30
|
|
|
|
|
|
|
|
|
31
|
1
|
|
|
1
|
|
717
|
use_ok $redis_class; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
19
|
|
|
|
1
|
|
|
|
|
805
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
470
|
my $redis = new_ok $redis_class, [api => 1]; |
|
34
|
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
476
|
can_ok $redis, 'parse', 'api', 'on_message', 'encode'; |
|
36
|
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
575
|
is $redis->api, 1, '$redis->api'; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Parsing method tests |
|
40
|
1
|
|
|
|
|
400
|
$redis->on_message(undef); |
|
41
|
1
|
|
|
|
|
5
|
_parse_string_ok($redis); |
|
42
|
1
|
|
|
|
|
941
|
_parse_bulk_ok($redis); |
|
43
|
1
|
|
|
|
|
1094
|
_parse_multi_bulk_ok($redis); |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# on_message works |
|
46
|
1
|
|
|
|
|
935
|
_on_message_ok($redis); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# Encoding method tests |
|
49
|
1
|
|
|
|
|
5
|
_encode_ok($redis); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
1
|
|
|
|
|
9
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _parse_string_ok { |
|
54
|
1
|
|
|
1
|
|
2
|
my $redis = shift; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Simple test |
|
57
|
1
|
|
|
|
|
5
|
$redis->parse("+test\r\n"); |
|
58
|
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
3
|
is_deeply $redis->get_message, |
|
60
|
|
|
|
|
|
|
{type => '+', data => 'test'}, |
|
61
|
|
|
|
|
|
|
'simple message'; |
|
62
|
|
|
|
|
|
|
|
|
63
|
1
|
|
|
|
|
715
|
is_deeply $redis->get_message, undef, 'queue is empty'; |
|
64
|
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
508
|
$redis->parse(":1\r\n"); |
|
66
|
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
5
|
is_deeply $redis->get_message, {type => ':', data => '1'}, |
|
68
|
|
|
|
|
|
|
'simple number'; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Binary test |
|
71
|
1
|
|
|
|
|
636
|
$redis->parse(join("\r\n", '$4', pack('C4', 0, 1, 2, 3), '')); |
|
72
|
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
5
|
is_deeply [unpack('C4', $redis->get_message->{data})], |
|
74
|
|
|
|
|
|
|
[0, 1, 2, 3], |
|
75
|
|
|
|
|
|
|
'binary data'; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# Chunked message |
|
78
|
1
|
|
|
|
|
672
|
$redis->parse('-tes'); |
|
79
|
1
|
|
|
|
|
4
|
$redis->parse("t2\r\n"); |
|
80
|
1
|
|
|
|
|
5
|
is_deeply $redis->get_message, |
|
81
|
|
|
|
|
|
|
{type => '-', data => 'test2'}, |
|
82
|
|
|
|
|
|
|
'chunked string'; |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# Two chunked messages together |
|
85
|
1
|
|
|
|
|
725
|
$redis->parse("+test"); |
|
86
|
1
|
|
|
|
|
5
|
$redis->parse("1\r\n-test"); |
|
87
|
1
|
|
|
|
|
9
|
$redis->parse("2\r\n"); |
|
88
|
1
|
|
|
|
|
5
|
is_deeply |
|
89
|
|
|
|
|
|
|
[$redis->get_message, $redis->get_message], |
|
90
|
|
|
|
|
|
|
[{type => '+', data => 'test1'}, {type => '-', data => 'test2'}], |
|
91
|
|
|
|
|
|
|
'first stick message'; |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# Pipelined |
|
94
|
1
|
|
|
|
|
1084
|
$redis->parse("+OK\r\n-ERROR\r\n"); |
|
95
|
1
|
|
|
|
|
3
|
is_deeply |
|
96
|
|
|
|
|
|
|
[$redis->get_message, $redis->get_message], |
|
97
|
|
|
|
|
|
|
[{type => '+', data => 'OK'}, {type => '-', data => 'ERROR'}], |
|
98
|
|
|
|
|
|
|
'pipelined status messages'; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub _parse_bulk_ok { |
|
102
|
1
|
|
|
1
|
|
2
|
my $redis = shift; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# Bulk message |
|
105
|
1
|
|
|
|
|
5
|
$redis->parse("\$4\r\ntest\r\n"); |
|
106
|
1
|
|
|
|
|
4
|
is_deeply $redis->get_message, |
|
107
|
|
|
|
|
|
|
{type => '$', data => 'test'}, |
|
108
|
|
|
|
|
|
|
'simple bulk message'; |
|
109
|
|
|
|
|
|
|
|
|
110
|
1
|
|
|
|
|
594
|
$redis->parse("\$5\r\ntes"); |
|
111
|
1
|
|
|
|
|
3
|
$redis->parse("t2\r\n"); |
|
112
|
1
|
|
|
|
|
3
|
is_deeply $redis->get_message, |
|
113
|
|
|
|
|
|
|
{type => '$', data => 'test2'}, |
|
114
|
|
|
|
|
|
|
'chunked bulk message'; |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# Nil bulk message |
|
117
|
1
|
|
|
|
|
814
|
$redis->parse("\$-1\r\n"); |
|
118
|
|
|
|
|
|
|
|
|
119
|
1
|
|
|
|
|
4
|
my $message = $redis->get_message; |
|
120
|
1
|
|
33
|
|
|
13
|
ok defined($message) && !defined($message->{data}), |
|
121
|
|
|
|
|
|
|
'nil bulk message'; |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# Two chunked bulk messages |
|
124
|
1
|
|
|
|
|
371
|
$redis->parse(join("\r\n", '$4', 'test', '+OK')); |
|
125
|
1
|
|
|
|
|
4
|
$redis->parse("\r\n"); |
|
126
|
1
|
|
|
|
|
5
|
is_deeply $redis->get_message, |
|
127
|
|
|
|
|
|
|
{type => '$', data => 'test'}, 'two chunked bulk messages'; |
|
128
|
1
|
|
|
|
|
593
|
is_deeply $redis->get_message, {type => '+', data => 'OK'}; |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
# Pipelined bulk message |
|
131
|
1
|
|
|
|
|
662
|
$redis->parse(join("\r\n", ('$3', 'ok1'), ('$3', 'ok2'), '')); |
|
132
|
1
|
|
|
|
|
4
|
is_deeply [$redis->get_message, $redis->get_message], |
|
133
|
|
|
|
|
|
|
[{type => '$', data => 'ok1'}, {type => '$', data => 'ok2'}], |
|
134
|
|
|
|
|
|
|
'piplined bulk message'; |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub _parse_multi_bulk_ok { |
|
138
|
1
|
|
|
1
|
|
3
|
my $redis = shift; |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
# Multi bulk message! |
|
141
|
1
|
|
|
|
|
4
|
$redis->parse("*1\r\n\$4\r\ntest\r\n"); |
|
142
|
|
|
|
|
|
|
|
|
143
|
1
|
|
|
|
|
4
|
is_deeply $redis->get_message, |
|
144
|
|
|
|
|
|
|
{type => '*', data => [{type => '$', data => 'test'}]}, |
|
145
|
|
|
|
|
|
|
'simple multibulk message'; |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
# Multi bulk message with multiple arguments |
|
148
|
1
|
|
|
|
|
1035
|
$redis->parse("*3\r\n\$5\r\ntest1\r\n"); |
|
149
|
1
|
|
|
|
|
4
|
$redis->parse("\$5\r\ntest2\r\n"); |
|
150
|
1
|
|
|
|
|
4
|
$redis->parse("\$5\r\ntest3\r\n"); |
|
151
|
|
|
|
|
|
|
|
|
152
|
1
|
|
|
|
|
34
|
is_deeply $redis->get_message, |
|
153
|
|
|
|
|
|
|
{ type => '*', |
|
154
|
|
|
|
|
|
|
data => [ |
|
155
|
|
|
|
|
|
|
{type => '$', data => 'test1'}, |
|
156
|
|
|
|
|
|
|
{type => '$', data => 'test2'}, |
|
157
|
|
|
|
|
|
|
{type => '$', data => 'test3'} |
|
158
|
|
|
|
|
|
|
] |
|
159
|
|
|
|
|
|
|
}, |
|
160
|
|
|
|
|
|
|
'multi argument multi-bulk message'; |
|
161
|
|
|
|
|
|
|
|
|
162
|
1
|
|
|
|
|
2046
|
$redis->parse("*0\r\n"); |
|
163
|
1
|
|
|
|
|
6
|
is_deeply $redis->get_message, |
|
164
|
|
|
|
|
|
|
{type => '*', data => []}, |
|
165
|
|
|
|
|
|
|
'multi-bulk empty result'; |
|
166
|
|
|
|
|
|
|
|
|
167
|
1
|
|
|
|
|
810
|
$redis->parse("*-1\r\n"); |
|
168
|
1
|
|
|
|
|
4
|
my $message = $redis->get_message; |
|
169
|
1
|
|
33
|
|
|
10
|
ok defined($message) && !defined($message->{data}), |
|
170
|
|
|
|
|
|
|
'multi-bulk nil result'; |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
# Does it work? |
|
173
|
1
|
|
|
|
|
637
|
$redis->parse("\$4\r\ntest\r\n"); |
|
174
|
1
|
|
|
|
|
4
|
is_deeply $redis->get_message, |
|
175
|
|
|
|
|
|
|
{type => '$', data => 'test'}, |
|
176
|
|
|
|
|
|
|
'everything still works'; |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
# Multi bulk message with status items |
|
179
|
1
|
|
|
|
|
656
|
$redis->parse(join("\r\n", ('*2', '+OK', '$4', 'test'), '')); |
|
180
|
1
|
|
|
|
|
5
|
is_deeply $redis->get_message, |
|
181
|
|
|
|
|
|
|
{ type => '*', |
|
182
|
|
|
|
|
|
|
data => [{type => '+', data => 'OK'}, {type => '$', data => 'test'}] |
|
183
|
|
|
|
|
|
|
}; |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
# splitted multi-bulk |
|
186
|
1
|
|
|
|
|
1135
|
$redis->parse(join("\r\n", ('*1', '$4', 'test'), '+OK')); |
|
187
|
1
|
|
|
|
|
5
|
$redis->parse("\r\n"); |
|
188
|
|
|
|
|
|
|
|
|
189
|
1
|
|
|
|
|
4
|
is_deeply $redis->get_message, |
|
190
|
|
|
|
|
|
|
{type => '*', data => [{type => '$', data => 'test'}]}; |
|
191
|
1
|
|
|
|
|
999
|
is_deeply $redis->get_message, {type => '+', data => 'OK'}; |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
# Another splitted multi-bulk message |
|
194
|
1
|
|
|
|
|
639
|
$redis->parse("*4\r\n\$-1\r\n\$-1"); |
|
195
|
1
|
|
|
|
|
3
|
$redis->parse("\r\n\$5\r\ntest2\r\n"); |
|
196
|
1
|
|
|
|
|
4
|
$redis->parse("\$5\r\ntest3\r"); |
|
197
|
1
|
|
|
|
|
4
|
$redis->parse("\n"); |
|
198
|
1
|
|
|
|
|
3
|
is_deeply $redis->get_message, { |
|
199
|
|
|
|
|
|
|
type => '*', |
|
200
|
|
|
|
|
|
|
data => [ |
|
201
|
|
|
|
|
|
|
{type => '$', data => undef}, |
|
202
|
|
|
|
|
|
|
{type => '$', data => undef}, |
|
203
|
|
|
|
|
|
|
{type => '$', data => 'test2'}, |
|
204
|
|
|
|
|
|
|
{type => '$', data => 'test3'} |
|
205
|
|
|
|
|
|
|
] |
|
206
|
|
|
|
|
|
|
}; |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
# Complex string |
|
209
|
1
|
|
|
|
|
1487
|
$redis->parse("\*4\r\n"); |
|
210
|
1
|
|
|
|
|
20
|
$redis->parse("\$5\r\ntest1\r\n\$-1\r\n:test2\r\n+test3\r\n\$5\r\n123"); |
|
211
|
1
|
|
|
|
|
4
|
$redis->parse("45\r\n"); |
|
212
|
1
|
|
|
|
|
3
|
is_deeply $redis->get_message, { |
|
213
|
|
|
|
|
|
|
type => '*', |
|
214
|
|
|
|
|
|
|
data => [ |
|
215
|
|
|
|
|
|
|
{type => '$', data => 'test1'}, |
|
216
|
|
|
|
|
|
|
{type => '$', data => undef}, |
|
217
|
|
|
|
|
|
|
{type => ':', data => 'test2'}, |
|
218
|
|
|
|
|
|
|
{type => '+', data => 'test3'} |
|
219
|
|
|
|
|
|
|
] |
|
220
|
|
|
|
|
|
|
}; |
|
221
|
1
|
|
|
|
|
1545
|
is_deeply $redis->get_message, { |
|
222
|
|
|
|
|
|
|
type => '$', |
|
223
|
|
|
|
|
|
|
data => '12345', |
|
224
|
|
|
|
|
|
|
}; |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
# pipelined multi-bulk |
|
227
|
1
|
|
|
|
|
690
|
$redis->parse( |
|
228
|
|
|
|
|
|
|
join("\r\n", |
|
229
|
|
|
|
|
|
|
('*2', '$3', 'ok1', '$3', 'ok2'), |
|
230
|
|
|
|
|
|
|
('*1', '$3', 'ok3'), '') |
|
231
|
|
|
|
|
|
|
); |
|
232
|
|
|
|
|
|
|
|
|
233
|
1
|
|
|
|
|
6
|
is_deeply $redis->get_message, |
|
234
|
|
|
|
|
|
|
{ type => '*', |
|
235
|
|
|
|
|
|
|
data => [{type => '$', data => 'ok1'}, {type => '$', data => 'ok2'}] |
|
236
|
|
|
|
|
|
|
}; |
|
237
|
1
|
|
|
|
|
1258
|
is_deeply $redis->get_message, |
|
238
|
|
|
|
|
|
|
{type => '*', data => [{type => '$', data => 'ok3'}]}; |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
} |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
sub _on_message_ok { |
|
243
|
1
|
|
|
1
|
|
4
|
my $redis = shift; |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
# Parsing with cb |
|
246
|
1
|
|
|
|
|
2
|
my $r = []; |
|
247
|
|
|
|
|
|
|
$redis->on_message( |
|
248
|
|
|
|
|
|
|
sub { |
|
249
|
4
|
|
|
4
|
|
9
|
my ($redis, $message) = @_; |
|
250
|
|
|
|
|
|
|
|
|
251
|
4
|
|
|
|
|
10
|
push @$r, $message; |
|
252
|
|
|
|
|
|
|
} |
|
253
|
1
|
|
|
|
|
9
|
); |
|
254
|
|
|
|
|
|
|
|
|
255
|
1
|
|
|
|
|
4
|
$redis->parse("+foo\r\n"); |
|
256
|
1
|
|
|
|
|
39
|
$redis->parse("\$3\r\nbar\r\n"); |
|
257
|
|
|
|
|
|
|
|
|
258
|
1
|
|
|
|
|
26
|
is_deeply $r, |
|
259
|
|
|
|
|
|
|
[{type => '+', data => 'foo'}, {type => '$', data => 'bar'}], |
|
260
|
|
|
|
|
|
|
'parsing with callback'; |
|
261
|
|
|
|
|
|
|
|
|
262
|
1
|
|
|
|
|
1056
|
$r = []; |
|
263
|
1
|
|
|
|
|
7
|
$redis->parse(join("\r\n", ('+foo'), ('$3', 'bar'), '')); |
|
264
|
|
|
|
|
|
|
|
|
265
|
1
|
|
|
|
|
9
|
is_deeply $r, |
|
266
|
|
|
|
|
|
|
[{type => '+', data => 'foo'}, {type => '$', data => 'bar'}], |
|
267
|
|
|
|
|
|
|
'pipelined parsing with callback'; |
|
268
|
|
|
|
|
|
|
|
|
269
|
1
|
|
|
|
|
1087
|
$redis->on_message(undef); |
|
270
|
|
|
|
|
|
|
} |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
sub _encode_ok { |
|
273
|
1
|
|
|
1
|
|
3
|
my $redis = shift; |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
# Encode message |
|
276
|
1
|
|
|
|
|
8
|
is $redis->encode({type => '+', data => 'OK'}), "+OK\r\n", |
|
277
|
|
|
|
|
|
|
'encode status'; |
|
278
|
1
|
|
|
|
|
416
|
is $redis->encode({type => '-', data => 'ERROR'}), "-ERROR\r\n", |
|
279
|
|
|
|
|
|
|
'encode error'; |
|
280
|
1
|
|
|
|
|
433
|
is $redis->encode({type => ':', data => '5'}), ":5\r\n", 'encode integer'; |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
# Encode bulk message |
|
283
|
1
|
|
|
|
|
366
|
is $redis->encode({type => '$', data => 'test'}), "\$4\r\ntest\r\n", |
|
284
|
|
|
|
|
|
|
'encode bulk'; |
|
285
|
1
|
|
|
|
|
687
|
is $redis->encode({type => '$', data => "\0\r\n"}), "\$3\r\n\0\r\n\r\n", |
|
286
|
|
|
|
|
|
|
'encode binary bulk'; |
|
287
|
1
|
|
|
|
|
774
|
is $redis->encode({type => '$', data => undef}), "\$-1\r\n", |
|
288
|
|
|
|
|
|
|
'encode nil bulk'; |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
# Encode multi-bulk |
|
291
|
1
|
|
|
|
|
370
|
is $redis->encode({type => '*', data => [{type => '$', data => 'test'}]}), |
|
292
|
|
|
|
|
|
|
join("\r\n", ('*1', '$4', 'test'), ''), |
|
293
|
|
|
|
|
|
|
'encode multi-bulk'; |
|
294
|
|
|
|
|
|
|
|
|
295
|
1
|
|
|
|
|
480
|
is $redis->encode( |
|
296
|
|
|
|
|
|
|
{ type => '*', |
|
297
|
|
|
|
|
|
|
data => [ |
|
298
|
|
|
|
|
|
|
{type => '$', data => 'test1'}, {type => '$', data => 'test2'} |
|
299
|
|
|
|
|
|
|
] |
|
300
|
|
|
|
|
|
|
} |
|
301
|
|
|
|
|
|
|
), |
|
302
|
|
|
|
|
|
|
join("\r\n", ('*2', '$5', 'test1', '$5', 'test2'), ''), |
|
303
|
|
|
|
|
|
|
'encode multi-bulk'; |
|
304
|
|
|
|
|
|
|
|
|
305
|
1
|
|
|
|
|
482
|
is $redis->encode({type => '*', data => []}), "\*0\r\n", |
|
306
|
|
|
|
|
|
|
'encode empty multi-bulk'; |
|
307
|
|
|
|
|
|
|
|
|
308
|
1
|
|
|
|
|
413
|
is $redis->encode({type => '*', data => undef}), "\*-1\r\n", |
|
309
|
|
|
|
|
|
|
'encode nil multi-bulk'; |
|
310
|
|
|
|
|
|
|
|
|
311
|
1
|
|
|
|
|
370
|
is $redis->encode( |
|
312
|
|
|
|
|
|
|
{ type => '*', |
|
313
|
|
|
|
|
|
|
data => [ |
|
314
|
|
|
|
|
|
|
{type => '$', data => 'foo'}, |
|
315
|
|
|
|
|
|
|
{type => '$', data => undef}, |
|
316
|
|
|
|
|
|
|
{type => '$', data => 'bar'} |
|
317
|
|
|
|
|
|
|
] |
|
318
|
|
|
|
|
|
|
} |
|
319
|
|
|
|
|
|
|
), |
|
320
|
|
|
|
|
|
|
join("\r\n", ('*3', '$3', 'foo', '$-1', '$3', 'bar'), ''), |
|
321
|
|
|
|
|
|
|
'encode multi-bulk with nil element'; |
|
322
|
|
|
|
|
|
|
} |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
1; |
|
325
|
|
|
|
|
|
|
__END__ |