Permalink
Browse files

verify arg passed to cmd or async_cmd

  • Loading branch information...
1 parent d4fe480 commit 81d6fc1c2a3f5e5a1f3983d477ece84643112e89 @wjackson committed Apr 27, 2012
Showing with 15 additions and 2 deletions.
  1. +3 −0 Changes
  2. +5 −1 lib/K.pm
  3. +1 −1 lib/K/Raw.pm
  4. +6 −0 t/k.t
View
@@ -1,3 +1,6 @@
+0.09 Wed. Apr 25, 2012
+ - Throw an exception if no arg is passed to K->cmd or K->async_cmd
+
0.08 Wed. Apr 25, 2012
- Fix bug where null values in q dictionaries causes a segfault
View
@@ -1,6 +1,6 @@
package K;
BEGIN {
- $K::VERSION = '0.08';
+ $K::VERSION = '0.09';
}
use Moose;
use namespace::autoclean;
@@ -67,12 +67,16 @@ sub _credentials {
sub cmd {
my ($self, $cmd) = @_;
+ confess q/No command provided/ if !defined $cmd;
+
return k($self->handle, $cmd);
}
sub async_cmd {
my ($self, $cmd) = @_;
+ confess q/No command provided/ if !defined $cmd;
+
return k(-$self->handle, $cmd);
}
View
@@ -1,6 +1,6 @@
package K::Raw;
BEGIN {
- $K::Raw::VERSION = '0.08';
+ $K::Raw::VERSION = '0.09';
}
use strict;
use warnings;
View
6 t/k.t
@@ -17,6 +17,12 @@ test_qserver {
my $timestamp = $k->cmd(q/2012.03.24D12:13:14.15161728/);
is "$timestamp", '385906394151617280', 'timestamp';
+
+ throws_ok { $k->cmd } qr/No command provided/,
+ 'cmd method needs an arg';
+
+ throws_ok { $k->async_cmd } qr/No command provided/,
+ 'async_cmd method needs an arg';
};
test_qserver {

0 comments on commit 81d6fc1

Please sign in to comment.