From d35dda5074f28a65c8b653e7020f0eb9e1f7cfca Mon Sep 17 00:00:00 2001 From: Serhii Zasenko Date: Tue, 3 Sep 2024 00:03:47 +0300 Subject: [PATCH] Add unknown version test to protocol redis testing suite --- lib/Protocol/Redis.pm | 2 +- lib/Protocol/Redis/Test.pm | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/Protocol/Redis.pm b/lib/Protocol/Redis.pm index 88c1484..fc25bf7 100644 --- a/lib/Protocol/Redis.pm +++ b/lib/Protocol/Redis.pm @@ -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. diff --git a/lib/Protocol/Redis/Test.pm b/lib/Protocol/Redis/Test.pm index d5ca4bb..41ca4e6 100644 --- a/lib/Protocol/Redis/Test.pm +++ b/lib/Protocol/Redis/Test.pm @@ -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'; @@ -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'); } } @@ -354,7 +361,7 @@ L =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.