Skip to content

Commit

Permalink
improve stub for [fileevent]
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Jun 27, 2010
1 parent c40557f commit 6bb906f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/Partcl/commands/main.pm
Expand Up @@ -160,6 +160,14 @@ our sub expr(*@args) {
}

our sub fileevent(*@args) {
if +@args < 2 || +@args > 3 {
error('wrong # args: should be "fileevent channelId event ?script?"');
}
my $channelId := @args.shift;
my $event := @args.shift;
if $event ne 'readable' || $event ne 'writable' {
error("bad event name \"$event\": must be readable or writable");
}
'';
}

Expand Down
6 changes: 3 additions & 3 deletions t/cmd_fileevent.t
Expand Up @@ -5,15 +5,15 @@ plan 4

eval_is {fileevent foo} \
{wrong # args: should be "fileevent channelId event ?script?"} \
{too few args} {TODO NQPRX}
{too few args}

eval_is {fileevent foo bar baz qux} \
{wrong # args: should be "fileevent channelId event ?script?"} \
{too many args} {TODO NQPRX}
{too many args}

eval_is {fileevent sock1 ontehoeni} \
{bad event name "ontehoeni": must be readable or writable} \
{bad channel *and* event} {TODO NQPRX}
{bad channel *and* event}

eval_is {fileevent sock1 readable} \
{can not find channel named "sock1"} \
Expand Down

0 comments on commit 6bb906f

Please sign in to comment.