[Bps-public-commit] Path-Dispatcher branch, complete, updated. e0d23b3939e3ae6d47ce3437e1ada7d690db41b0
sartak at bestpractical.com
sartak at bestpractical.com
Fri Dec 18 19:26:49 EST 2009
The branch, complete has been updated
via e0d23b3939e3ae6d47ce3437e1ada7d690db41b0 (commit)
from 301d1354d9b8468a7861c203dcf2973ef154faff (commit)
Summary of changes:
t/300-complete-simple.t | 39 +++++++++++++++++++++++++++------------
1 files changed, 27 insertions(+), 12 deletions(-)
- Log -----------------------------------------------------------------
commit e0d23b3939e3ae6d47ce3437e1ada7d690db41b0
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Fri Dec 18 19:26:40 2009 -0500
Another complete_ok refactor
diff --git a/t/300-complete-simple.t b/t/300-complete-simple.t
index 4354f19..fa5479e 100644
--- a/t/300-complete-simple.t
+++ b/t/300-complete-simple.t
@@ -23,16 +23,31 @@ do {
};
my $dispatcher = MyApp::Dispatcher->dispatcher;
-is_deeply([$dispatcher->complete('x')], [], 'no completions for "x"');
-is_deeply([$dispatcher->complete('foooo')], [], 'no completions for "foooo"');
-is_deeply([$dispatcher->complete('baq')], [], 'no completions for "baq"');
-
-is_deeply([$dispatcher->complete('f')], ['foo'], 'one completion for "f"');
-is_deeply([$dispatcher->complete('fo')], ['foo'], 'one completion for "fo"');
-is_deeply([$dispatcher->complete('foo')], [], '"foo" is already complete');
-
-is_deeply([$dispatcher->complete('b')], ['bar', 'baz'], 'two completions for "b"');
-is_deeply([$dispatcher->complete('ba')], ['bar', 'baz'], 'two completions for "ba"');
-is_deeply([$dispatcher->complete('bar')], [], '"bar" is already complete');
-is_deeply([$dispatcher->complete('baz')], [], '"baz" is already complete');
+sub complete_ok {
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+ my $path = shift;
+ my @expected = @_;
+
+ my @got = $dispatcher->complete($path);
+
+ my $message = @expected == 0 ? "no completions"
+ : @expected == 1 ? "one completion"
+ : @expected . " completions";
+ $message .= " for path '$path'";
+
+ is_deeply(\@got, \@expected, $message);
+}
+
+complete_ok('x');
+complete_ok('foooo');
+complete_ok('baq');
+
+complete_ok(f => 'foo');
+complete_ok(fo => 'foo');
+complete_ok('foo');
+
+complete_ok('b' => 'bar', 'baz');
+complete_ok('ba' => 'bar', 'baz');
+complete_ok('bar');
+complete_ok('baz');
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list