Skip to content

Commit 03f38e7

Browse files
committed
Added several unit tests
1 parent 6288d46 commit 03f38e7

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

t/10-exceptions.t

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use 5.008000;
22
use strict;
33
use warnings;
44

5-
use Test::More tests => 15;
5+
use Test::More tests => 20;
66
use Test::Fatal;
77
use AnyEvent::RipeRedis;
88

@@ -153,15 +153,55 @@ sub t_not_allowed_after_multi {
153153
$redis->subscribe('channel');
154154
},
155155
qr/Command "subscribe" not allowed after "multi" command\./,
156-
"t_not_allowed_after_multi; SUBSCRIBE",
156+
"not allowed after multi; SUBSCRIBE",
157+
);
158+
159+
like(
160+
exception {
161+
$redis->unsubscribe('channel');
162+
},
163+
qr/Command "unsubscribe" not allowed after "multi" command\./,
164+
"not allowed after multi; UNSUBSCRIBE",
165+
);
166+
167+
like(
168+
exception {
169+
$redis->psubscribe('pattern_*');
170+
},
171+
qr/Command "psubscribe" not allowed after "multi" command\./,
172+
"not allowed after multi; PSUBSCRIBE",
173+
);
174+
175+
like(
176+
exception {
177+
$redis->punsubscribe('pattern_*');
178+
},
179+
qr/Command "punsubscribe" not allowed after "multi" command\./,
180+
"not allowed after multi; PUNSUBSCRIBE",
181+
);
182+
183+
like(
184+
exception {
185+
$redis->info;
186+
},
187+
qr/Command "info" not allowed after "multi" command\./,
188+
"not allowed after multi; INFO",
157189
);
158190

159191
like(
160192
exception {
161193
$redis->select(2);
162194
},
163195
qr/Command "select" not allowed after "multi" command\./,
164-
"t_not_allowed_after_multi; SELECT",
196+
"not allowed after multi; SELECT",
197+
);
198+
199+
like(
200+
exception {
201+
$redis->quit;
202+
},
203+
qr/Command "quit" not allowed after "multi" command\./,
204+
"not allowed after multi; QUIT",
165205
);
166206

167207
$redis->disconnect;

0 commit comments

Comments
 (0)