Skip to content

Commit d35dda5

Browse files
committed
Add unknown version test to protocol redis testing suite
1 parent bd50849 commit d35dda5

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/Protocol/Redis.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ Yaroslav Korshak (yko)
289289
290290
=head1 COPYRIGHT AND LICENSE
291291
292-
Copyright (C) 2011-2019, Sergey Zasenko.
292+
Copyright (C) 2011-2024, Sergey Zasenko.
293293
294294
This program is free software, you can redistribute it and/or modify it under
295295
the same terms as Perl 5.10.

lib/Protocol/Redis/Test.pm

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ sub _apiv1_ok {
2626
my $redis_class = shift;
2727

2828
subtest 'Protocol::Redis APIv1 ok' => sub {
29-
plan tests => 43;
29+
plan tests => 44;
3030

3131
use_ok $redis_class;
3232

33+
# Version 1 protocol
3334
my $redis = new_ok $redis_class, [api => 1];
3435

3536
can_ok $redis, 'parse', 'api', 'on_message', 'encode';
@@ -47,6 +48,12 @@ sub _apiv1_ok {
4748

4849
# Encoding method tests
4950
_encode_ok($redis);
51+
52+
# Unknown version should raise an exception
53+
eval {
54+
new($redis_class, api => 0);
55+
};
56+
ok($@, 'unknown version raises an exception');
5057
}
5158
}
5259

@@ -354,7 +361,7 @@ L<Protocol::Redis>
354361
355362
=head1 COPYRIGHT AND LICENSE
356363
357-
Copyright (C) 2010-2011, Sergey Zasenko
364+
Copyright (C) 2010-2024, Sergey Zasenko
358365
359366
This program is free software, you can redistribute it and/or modify it under
360367
the terms of the Artistic License version 2.0.

0 commit comments

Comments
 (0)