[Bps-public-commit] r15462 - in Path-Dispatcher/trunk: t t/lib/Path/Dispatcher/Test
sartak at bestpractical.com
sartak at bestpractical.com
Mon Aug 25 22:34:25 EDT 2008
Author: sartak
Date: Mon Aug 25 22:34:24 2008
New Revision: 15462
Added:
Path-Dispatcher/trunk/t/103-input.t
Modified:
Path-Dispatcher/trunk/ (props changed)
Path-Dispatcher/trunk/t/lib/Path/Dispatcher/Test/App.pm
Path-Dispatcher/trunk/t/lib/Path/Dispatcher/Test/Framework.pm
Log:
r70351 at onn: sartak | 2008-08-25 22:34:16 -0400
Tests for what the rule closures receive as input. Needs improvement!
Added: Path-Dispatcher/trunk/t/103-input.t
==============================================================================
--- (empty file)
+++ Path-Dispatcher/trunk/t/103-input.t Mon Aug 25 22:34:24 2008
@@ -0,0 +1,27 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 1;
+use lib 't/lib';
+use Path::Dispatcher::Test::App;
+
+our @calls;
+
+Path::Dispatcher::Test::App->run('args', 1..3);
+is_deeply([splice @calls], [
+ {
+ from => 'app',
+ one => 'g',
+ two => undef,
+ it => undef,
+ args => [1, 2, 3],
+ },
+ {
+ from => 'framework',
+ one => 'g',
+ two => undef,
+ it => undef,
+ args => [1, 2, 3],
+ },
+]);
+
Modified: Path-Dispatcher/trunk/t/lib/Path/Dispatcher/Test/App.pm
==============================================================================
--- Path-Dispatcher/trunk/t/lib/Path/Dispatcher/Test/App.pm (original)
+++ Path-Dispatcher/trunk/t/lib/Path/Dispatcher/Test/App.pm Mon Aug 25 22:34:24 2008
@@ -30,5 +30,16 @@
push @main::calls, 'app after next_rule 2';
};
+on qr/ar(g)s/ => sub {
+ push @main::calls, {
+ from => "app",
+ args => [@_],
+ it => $_,
+ one => $1,
+ two => $2,
+ };
+ next_rule;
+};
+
1;
Modified: Path-Dispatcher/trunk/t/lib/Path/Dispatcher/Test/Framework.pm
==============================================================================
--- Path-Dispatcher/trunk/t/lib/Path/Dispatcher/Test/Framework.pm (original)
+++ Path-Dispatcher/trunk/t/lib/Path/Dispatcher/Test/Framework.pm Mon Aug 25 22:34:24 2008
@@ -32,5 +32,15 @@
push @main::calls, 'framework after next_rule 2';
};
+on qr/ar(g)s/ => sub {
+ push @main::calls, {
+ from => "framework",
+ args => [@_],
+ it => $_,
+ one => $1,
+ two => $2,
+ };
+};
+
1;
More information about the Bps-public-commit
mailing list