[Bps-public-commit] Path-Dispatcher branch, lazy-dispatch, updated. ee2983d69f351524c8c86756b59fb952104a1e5b

sartak at bestpractical.com sartak at bestpractical.com
Fri Nov 6 20:53:09 EST 2009


The branch, lazy-dispatch has been updated
       via  ee2983d69f351524c8c86756b59fb952104a1e5b (commit)
      from  eb5928a6bbc288143532fadba53249fa8c7a62e6 (commit)

Summary of changes:
 t/023-lazy-dispatch.t |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 t/023-lazy-dispatch.t

- Log -----------------------------------------------------------------
commit ee2983d69f351524c8c86756b59fb952104a1e5b
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Oct 16 16:25:40 2009 -0400

    Add failing test for lazy dispatch

diff --git a/t/023-lazy-dispatch.t b/t/023-lazy-dispatch.t
new file mode 100644
index 0000000..588fe72
--- /dev/null
+++ b/t/023-lazy-dispatch.t
@@ -0,0 +1,23 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 1;
+use Path::Dispatcher;
+
+my @calls;
+
+my $dispatcher = Path::Dispatcher->new;
+$dispatcher->add_rule(
+    Path::Dispatcher::Rule::Tokens->new(
+        tokens => ['hello'],
+        block  => sub { push @calls, 'hello' },
+    ),
+    Path::Dispatcher::Rule::CodeRef->new(
+        matcher => sub { fail("should never run") },
+        block  => sub { push @calls, 'fail' },
+    ),
+);
+
+$dispatcher->run('foo bar');
+is_deeply([splice @calls], ['hello']);
+

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list