Skip to content

Commit

Permalink
Add unknown version test to protocol redis testing suite
Browse files Browse the repository at this point in the history
  • Loading branch information
und3f committed Sep 2, 2024
1 parent bd50849 commit d35dda5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Protocol/Redis.pm
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ Yaroslav Korshak (yko)
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2011-2019, Sergey Zasenko.
Copyright (C) 2011-2024, Sergey Zasenko.
This program is free software, you can redistribute it and/or modify it under
the same terms as Perl 5.10.
Expand Down
11 changes: 9 additions & 2 deletions lib/Protocol/Redis/Test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ sub _apiv1_ok {
my $redis_class = shift;

subtest 'Protocol::Redis APIv1 ok' => sub {
plan tests => 43;
plan tests => 44;

use_ok $redis_class;

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

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

# Encoding method tests
_encode_ok($redis);

# Unknown version should raise an exception
eval {
new($redis_class, api => 0);
};
ok($@, 'unknown version raises an exception');
}
}

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

0 comments on commit d35dda5

Please sign in to comment.