[Bps-public-commit] r16624 - in Path-Dispatcher/trunk: t

sartak at bestpractical.com sartak at bestpractical.com
Thu Oct 30 00:30:22 EDT 2008


Author: sartak
Date: Thu Oct 30 00:30:21 2008
New Revision: 16624

Added:
   Path-Dispatcher/trunk/t/104-config.t
Modified:
   Path-Dispatcher/trunk/   (props changed)

Log:
 r74861 at onn:  sartak | 2008-10-30 00:29:42 -0400
 Tests for token_delimiter and case_sensitive_tokens config


Added: Path-Dispatcher/trunk/t/104-config.t
==============================================================================
--- (empty file)
+++ Path-Dispatcher/trunk/t/104-config.t	Thu Oct 30 00:30:21 2008
@@ -0,0 +1,31 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 5;
+
+my @calls;
+
+do {
+    package RESTy::Dispatcher;
+    use Path::Dispatcher::Declarative -base;
+
+    sub token_delimiter { '/' }
+    sub case_sensitive_tokens { 0 }
+
+    on ['=', 'model', 'Comment'] => sub { push @calls, $3 };
+};
+
+ok(RESTy::Dispatcher->isa('Path::Dispatcher::Declarative'), "use Path::Dispatcher::Declarative sets up ISA");
+
+RESTy::Dispatcher->run('= model Comment');
+is_deeply([splice @calls], []);
+
+RESTy::Dispatcher->run('/=/model/Comment');
+is_deeply([splice @calls], ["Comment"]);
+
+RESTy::Dispatcher->run('/=/model/comment');
+is_deeply([splice @calls], ["comment"]);
+
+RESTy::Dispatcher->run('///=///model///COMMENT///');
+is_deeply([splice @calls], ["COMMENT"]);
+



More information about the Bps-public-commit mailing list