[dw-free] DW/Controller/Admin.pm fails 00-compile.t
[commit: http://hg.dwscoalition.org/dw-free/rev/6cc9672da71b]
http://bugs.dwscoalition.org/show_bug.cgi?id=3182
Additional routing tests, to check whether the routing table is non-empty.
Patch by
exor674.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3182
Additional routing tests, to check whether the routing table is non-empty.
Patch by
Files modified:
- t/bin/routing-table-helper.pl
- t/routing-table.t
- t/routing.t
--------------------------------------------------------------------------------
diff -r 2006aa9eb358 -r 6cc9672da71b t/bin/routing-table-helper.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/t/bin/routing-table-helper.pl Wed Nov 10 17:10:46 2010 +0800
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+#
+# t/bin/routing-table-helper.pl
+#
+# Test to make sure the routing table is non-empty
+# This must stay in it's own file, do not merge this back into t/routing-table.t
+#
+# Authors:
+# Andrea Nall <anall@andreanall.com>
+#
+# Copyright (c) 2010 by Dreamwidth Studios, LLC.
+#
+# This program is free software; you may redistribute it and/or modify it under
+# the same terms as Perl itself. For a copy of the license, please reference
+# 'perldoc perlartistic' or 'perldoc perlgpl'.
+#
+use strict;
+use DW::Routing;
+
+my $ct = scalar keys %DW::Routing::string_choices;
+
+$ct += scalar @$_ foreach values %DW::Routing::regex_choices;
+
+isnt( $ct, 0, "routing table empty" );
+
+# test some known lookups!
+
+ok( defined DW::Routing->get_call_opts( uri => "/nav", app => 1 ) );
+ok( defined DW::Routing->get_call_opts( uri => "/nav/read", app => 1 ) );
+ok( defined DW::Routing->get_call_opts( uri => "/admin", app => 1 ) );
+ok( defined DW::Routing->get_call_opts( uri => "/admin/", app => 1 ) );
+ok( defined DW::Routing->get_call_opts( uri => "/admin/index", app => 1 ) );
+
+1;
diff -r 2006aa9eb358 -r 6cc9672da71b t/routing-table.t
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/t/routing-table.t Wed Nov 10 17:10:46 2010 +0800
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+#
+# t/routing-table.t
+#
+# Test to make sure the routing table is non-empty
+#
+# Authors:
+# Andrea Nall <anall@andreanall.com>
+#
+# Copyright (c) 2010 by Dreamwidth Studios, LLC.
+#
+# This program is free software; you may redistribute it and/or modify it under
+# the same terms as Perl itself. For a copy of the license, please reference
+# 'perldoc perlartistic' or 'perldoc perlgpl'.
+#
+use strict;
+use Test::More tests => 6;
+use lib "$ENV{LJHOME}/cgi-bin";
+require 'ljlib.pl';
+require $LJ::HOME . "/t/bin/routing-table-helper.pl";
\ No newline at end of file
diff -r 2006aa9eb358 -r 6cc9672da71b t/routing.t
--- a/t/routing.t Wed Nov 10 01:27:54 2010 -0600
+++ b/t/routing.t Wed Nov 10 17:10:46 2010 +0800
@@ -1,10 +1,26 @@
-# -*-perl-*-
+#!/usr/bin/perl
+#
+# t/routing.t
+#
+# Test to make sure routing works as expected.
+#
+# Authors:
+# Andrea Nall <anall@andreanall.com>
+#
+# Copyright (c) 2009-2010 by Dreamwidth Studios, LLC.
+#
+# This program is free software; you may redistribute it and/or modify it under
+# the same terms as Perl itself. For a copy of the license, please reference
+# 'perldoc perlartistic' or 'perldoc perlgpl'.
+#
use strict;
-use Test::More tests => 194;
+use Test::More tests => 195;
use lib "$ENV{LJHOME}/cgi-bin";
# don't let DW::Routing load DW::Controller subclasses
-$DW::Routing::DONT_LOAD = 1;
+BEGIN {
+ $DW::Routing::DONT_LOAD = 1;
+}
require 'ljlib.pl';
use DW::Request::Standard;
@@ -14,6 +30,12 @@ my $result;
my $result;
my $expected_format = 'html';
my $__name;
+
+my $ct = scalar keys %DW::Routing::string_choices;
+
+$ct += scalar @$_ foreach values %DW::Routing::regex_choices;
+
+is( $ct, 0, "routing table empty" );
handle_request( "foo", "/foo", 0, 0 ); # 1 test
handle_request( "foo", "/foo.format", 0, 0 ); # 1 test
--------------------------------------------------------------------------------
