[Bps-public-commit] r14812 - in Path-Dispatcher/trunk: t

sartak at bestpractical.com sartak at bestpractical.com
Tue Aug 5 18:42:48 EDT 2008


Author: sartak
Date: Tue Aug  5 18:42:48 2008
New Revision: 14812

Added:
   Path-Dispatcher/trunk/t/009-args.t
Modified:
   Path-Dispatcher/trunk/   (props changed)

Log:
 r54125 at gorgoroth:  sartak | 2008-08-05 18:38:25 -0400
 Failing tests for dispatching with arguments


Added: Path-Dispatcher/trunk/t/009-args.t
==============================================================================
--- (empty file)
+++ Path-Dispatcher/trunk/t/009-args.t	Tue Aug  5 18:42:48 2008
@@ -0,0 +1,27 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 2;
+use Path::Dispatcher;
+
+my @calls;
+
+my $dispatcher = Path::Dispatcher->new;
+$dispatcher->add_rule(
+    regex => qr/foo/,
+    block => sub { push @calls, [@_] },
+);
+
+$dispatcher->run('foo', 42);
+
+is_deeply([splice @calls], [
+    [42],
+]);
+
+my $code = $dispatcher->dispatch('foo');
+$code->(24);
+
+is_deeply([splice @calls], [
+    [24],
+]);
+



More information about the Bps-public-commit mailing list