From 6bb906fe319b165613aef728e5a3651f2bb148c3 Mon Sep 17 00:00:00 2001 From: Coke Date: Sat, 26 Jun 2010 22:37:56 -0400 Subject: [PATCH] improve stub for [fileevent] --- src/Partcl/commands/main.pm | 8 ++++++++ t/cmd_fileevent.t | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Partcl/commands/main.pm b/src/Partcl/commands/main.pm index e0ebc93..60c7078 100644 --- a/src/Partcl/commands/main.pm +++ b/src/Partcl/commands/main.pm @@ -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"); + } ''; } diff --git a/t/cmd_fileevent.t b/t/cmd_fileevent.t index 464f77b..18708ef 100755 --- a/t/cmd_fileevent.t +++ b/t/cmd_fileevent.t @@ -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"} \