[Bps-public-commit] Path-Dispatcher branch, master, updated. 648981019b0d3ef77f2f456f33438e500afc8643

Shawn Moore sartak at bestpractical.com
Wed Jun 23 11:31:29 EDT 2010


The branch, master has been updated
       via  648981019b0d3ef77f2f456f33438e500afc8643 (commit)
      from  93548a3de60ff0ce42a22c31d48669762c901b12 (commit)

Summary of changes:
 t/903-number-vars.t |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 t/903-number-vars.t

- Log -----------------------------------------------------------------
commit 648981019b0d3ef77f2f456f33438e500afc8643
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Jun 23 11:32:35 2010 -0400

    Failing tests for various $1 issues

diff --git a/t/903-number-vars.t b/t/903-number-vars.t
new file mode 100644
index 0000000..6ed9f50
--- /dev/null
+++ b/t/903-number-vars.t
@@ -0,0 +1,33 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 6;
+use Test::Exception;
+use Path::Dispatcher;
+
+my @vars;
+
+"abc" =~ /(.)(.)(.)/;
+
+my $dispatcher = Path::Dispatcher->new(
+    rules => [
+        Path::Dispatcher::Rule::Tokens->new(
+            tokens => ['bus', 'train'],
+            block  => sub { push @vars, [$1, $2, $3] },
+        ),
+    ],
+);
+
+is_deeply([splice @vars], []);
+is_deeply([$1, $2, $3, $4], ["a", "b", "c", undef]);
+
+my $dispatch = $dispatcher->dispatch("bus train");
+
+is_deeply([splice @vars], []);
+is_deeply([$1, $2, $3, $4], ["a", "b", "c", undef]);
+
+$dispatch->run;
+
+is_deeply([splice @vars], [['bus', 'train', undef]]);
+is_deeply([$1, $2, $3, $4], ["a", "b", "c", undef]);
+

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



More information about the Bps-public-commit mailing list