[Bps-public-commit] Path-Dispatcher branch, complete, updated. fd41e0f526652b4ab562959a10aaefb6d63137bd
sartak at bestpractical.com
sartak at bestpractical.com
Fri Dec 18 19:18:29 EST 2009
The branch, complete has been updated
via fd41e0f526652b4ab562959a10aaefb6d63137bd (commit)
from 318997cdc782ef5c4f1f46d454bdc2e156159868 (commit)
Summary of changes:
lib/Path/Dispatcher/Rule/Tokens.pm | 2 +-
t/301-complete-complex.t | 11 ++++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit fd41e0f526652b4ab562959a10aaefb6d63137bd
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Fri Dec 18 19:18:15 2009 -0500
A fix for, and more tests for, token matching
diff --git a/lib/Path/Dispatcher/Rule/Tokens.pm b/lib/Path/Dispatcher/Rule/Tokens.pm
index 8096005..8e4fb86 100644
--- a/lib/Path/Dispatcher/Rule/Tokens.pm
+++ b/lib/Path/Dispatcher/Rule/Tokens.pm
@@ -69,7 +69,7 @@ sub complete {
my $part = @$got ? shift @$got : '';
return unless substr($next, 0, length($part)) eq $part;
- return $next;
+ return $self->untokenize(@$matched, $next);
}
sub _each_token {
diff --git a/t/301-complete-complex.t b/t/301-complete-complex.t
index 53db089..883371a 100644
--- a/t/301-complete-complex.t
+++ b/t/301-complete-complex.t
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 12;
+use Test::More tests => 17;
do {
package MyApp::Dispatcher;
@@ -31,8 +31,17 @@ do {
my $dispatcher = MyApp::Dispatcher->dispatcher;
is_deeply([$dispatcher->complete('x')], [], 'no completions for "x"');
+
is_deeply([$dispatcher->complete('a')], ['alpha'], 'one completion for "a"');
is_deeply([$dispatcher->complete('alpha')], ['alpha one', 'alpha two', 'alpha three'], 'three completions for "alpha"');
+
+is_deeply([$dispatcher->complete('t')], ['token'], 'one completion for "t"');
+is_deeply([$dispatcher->complete('token')], ['token matching'], 'one completion for "token"');
+is_deeply([$dispatcher->complete('token ')], ['token matching'], 'one completion for "token "');
+is_deeply([$dispatcher->complete('token m')], ['token matching'], 'one completion for "token m"');
+is_deeply([$dispatcher->complete('token matchin')], ['token matching'], 'one completion for "token matchin"');
+is_deeply([$dispatcher->complete('token matching')], [], 'no completions for "token matching"');
+
is_deeply([$dispatcher->complete('q')], ['quux'], 'one completion for "quux"');
is_deeply([$dispatcher->complete('bet')], ['beta'], 'one completion for "beta"');
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list