[Jifty-commit] r7515 - Template-Declare/trunk/t

Jifty commits jifty-commit at lists.jifty.org
Wed Oct 7 00:00:11 EDT 2009


Author: theory
Date: Wed Oct  7 00:00:08 2009
New Revision: 7515

Modified:
   Template-Declare/trunk/t/aliasing.t
   Template-Declare/trunk/t/deep_aliasing.t
   Template-Declare/trunk/t/deep_importing.t
   Template-Declare/trunk/t/relative-aliasing.t
   Template-Declare/trunk/t/relative-pathing.t
   Template-Declare/trunk/t/similar-aliases.t

Log:
Added some formatting and test descriptions, as well as a few more tests, as I
read through all of the tests that have to do with aliasing in order to ensure
that I haven't missed anything.


Modified: Template-Declare/trunk/t/aliasing.t
==============================================================================
--- Template-Declare/trunk/t/aliasing.t	(original)
+++ Template-Declare/trunk/t/aliasing.t	Wed Oct  7 00:00:08 2009
@@ -1,6 +1,7 @@
 use warnings;
 use strict;
 
+##############################################################################
 package Wifty::UI::aliased_pkg;
 use base qw/Template::Declare/;
 use Template::Declare::Tags;
@@ -11,10 +12,12 @@
     div { 'Variable ', $self->package_variable('VARIABLE') };
 };
 
+##############################################################################
 package Wifty::UI::aliased_subclass_pkg;
 use base qw/Wifty::UI::aliased_pkg/;
 use Template::Declare::Tags;
 
+##############################################################################
 package Wifty::UI;
 use base qw/Template::Declare/;
 use Template::Declare::Tags;
@@ -40,6 +43,7 @@
 alias Wifty::UI::aliased_pkg under '/aliased_pkg2';
 alias Wifty::UI::aliased_subclass_pkg under '/aliased_subclass_pkg';
 
+##############################################################################
 package main;
 use Template::Declare::Tags;
 Template::Declare->init( dispatch_to => ['Wifty::UI'] );

Modified: Template-Declare/trunk/t/deep_aliasing.t
==============================================================================
--- Template-Declare/trunk/t/deep_aliasing.t	(original)
+++ Template-Declare/trunk/t/deep_aliasing.t	Wed Oct  7 00:00:08 2009
@@ -1,7 +1,7 @@
 use warnings;
 use strict;
 
-
+##############################################################################
 package SearchPlugin::View;
 
 use base qw/Template::Declare/;
@@ -11,6 +11,7 @@
     h1 {'SearchPlugin::View::search'};
 };
 
+##############################################################################
 package ListPlugin::View;
 
 use base qw/Template::Declare/;
@@ -22,7 +23,7 @@
 
 alias SearchPlugin::View under '/';
 
-
+##############################################################################
 package MyApp::View;
 
 use base qw/Template::Declare/;
@@ -32,32 +33,29 @@
 
 alias ListPlugin::View under '/plugin';
 
+##############################################################################
 package main;
 Template::Declare->init( dispatch_to => ['MyApp::View'] );
 
-use Test::More tests => 12;
+use Test::More tests => 14;
 use Test::Warn;
 require "t/utils.pl";
 
-ok( MyApp::View->has_template('toplevel') );
-ok( !MyApp::View->has_template('listing') , "the listing template isn't imported to the top level");
+ok( MyApp::View->has_template('toplevel'), 'Should have toplevel template' );
+ok( !MyApp::View->has_template('listing'), "the listing template isn't imported to the top level");
 ok( !MyApp::View->has_template('search'), "The search template isn't imported to the top level" );
 ok( MyApp::View->has_template('/plugin/listing'), 'has listing template' );
 ok( MyApp::View->has_template('/plugin/search'), 'has search template' );
 
-
-
-
-
 {
     my $simple = ( Template::Declare->show('toplevel'));
-    like( $simple, qr'Toplevel' );
+    like( $simple, qr'Toplevel', 'Can execute toplevel template' );
 }
 {
     warning_like {
         my $simple = ( Template::Declare->show('listing') ||'');
         unlike( $simple, qr'listing',
-            'can not call a toplevel "listing" template' );
+            'Cannot call a toplevel "listing" template' );
         }
         qr/The template 'listing' could not be found/,
         "listing is private"
@@ -65,20 +63,21 @@
 }
 warning_like {
     my $simple = ( Template::Declare->show('search')||'');
-    unlike( $simple, qr'search', "Can not call a toplevel /search" );
+    unlike( $simple, qr'search', "Cannot call a toplevel /search" );
 } qr/The template 'search' could not be found/, "Search could not be found";
 
-
-
 {
 
     my $simple = ( Template::Declare->show('/plugin/listing'));
     like( $simple, qr'listing', "Can call /plugin/listing" );
+    $simple = ( Template::Declare->show('plugin/listing'));
+    like( $simple, qr'listing', "Can call plugin/listing" );
 }
 {
     my $simple = ( Template::Declare->show('/plugin/search'));
     like( $simple, qr'search' , "Can call /plugin/search");
+    $simple = ( Template::Declare->show('plugin/search'));
+    like( $simple, qr'search' , "Can call plugin/search");
 }
 
-
 1;

Modified: Template-Declare/trunk/t/deep_importing.t
==============================================================================
--- Template-Declare/trunk/t/deep_importing.t	(original)
+++ Template-Declare/trunk/t/deep_importing.t	Wed Oct  7 00:00:08 2009
@@ -1,7 +1,7 @@
 use warnings;
 use strict;
 
-
+##############################################################################
 package Plugin2::View;
 
 use base qw/Template::Declare/;
@@ -11,6 +11,7 @@
     h1 {'Plugin2::View::search'};
 };
 
+##############################################################################
 package Plugin1::View;
 
 use base qw/Template::Declare/;
@@ -23,6 +24,7 @@
 import_templates Plugin2::View under '/';
 
 
+##############################################################################
 package MyApp::View;
 
 use base qw/Template::Declare/;
@@ -32,46 +34,46 @@
 
 import_templates Plugin1::View under '/plugin';
 
+##############################################################################
 package main;
 Template::Declare->init( dispatch_to => ['MyApp::View'] );
 
-use Test::More tests => 12;
+use Test::More tests => 14;
 use Test::Warn;
 require "t/utils.pl";
 
-ok( MyApp::View->has_template('toplevel') );
-ok( !MyApp::View->has_template('listing') );
-ok( !MyApp::View->has_template('search') );
+ok( MyApp::View->has_template('toplevel'), 'Should have toplevel template' );
+ok( !MyApp::View->has_template('listing'), "the listing template isn't imported to the top level");
+ok( !MyApp::View->has_template('search'), "The search template isn't imported to the top level" );
 ok( MyApp::View->has_template('/plugin/listing'), 'has listing template' );
 ok( MyApp::View->has_template('/plugin/search'), 'has search template' );
 
-
-
-
-
 {
     my $simple = ( Template::Declare->show('toplevel'))||'';
-    like( $simple, qr'Toplevel' );
+    like( $simple, qr'Toplevel', 'Can execute toplevel template' );
 }
 warning_like
 {
     my $simple = ( Template::Declare->show('listing'))||'';
-    unlike( $simple, qr'listing' , 'can not call a toplevel "listing" template');
+    unlike( $simple, qr'listing' , 'Cannot call a toplevel "listing" template');
 }
 qr/The template 'listing' could not be found/, "calling a missing component gets warned";
 {
     my $simple = ( Template::Declare->show('/plugin/listing'))||'';
     like( $simple, qr'listing', "Can call /plugin/listing" );
+    $simple = ( Template::Declare->show('plugin/listing'))||'';
+    like( $simple, qr'listing', "Can call plugin/listing" );
 }
 warning_like {
     my $simple = ( Template::Declare->show('search'))||'';
-    unlike( $simple, qr'search', "Can not call a toplevel /search" );
+    unlike( $simple, qr'search', "Cannot call a toplevel /search" );
 }
 qr/The template 'search' could not be found/, "calling a missing component gets warned";
 {
     my $simple = ( Template::Declare->show('/plugin/search')) ||'';
     like( $simple, qr'search' , "Can call /plugin/search");
+    $simple = ( Template::Declare->show('plugin/search')) ||'';
+    like( $simple, qr'search' , "Can call plugin/search");
 }
 
-
 1;

Modified: Template-Declare/trunk/t/relative-aliasing.t
==============================================================================
--- Template-Declare/trunk/t/relative-aliasing.t	(original)
+++ Template-Declare/trunk/t/relative-aliasing.t	Wed Oct  7 00:00:08 2009
@@ -1,7 +1,7 @@
 use warnings;
 use strict;
 
-
+##############################################################################
 package SearchPlugin::View;
 
 use base qw/Template::Declare/;
@@ -11,6 +11,7 @@
     h1 {'SearchPlugin::View::search'};
 };
 
+##############################################################################
 package ListPlugin::View;
 
 use base qw/Template::Declare/;
@@ -22,7 +23,7 @@
 
 alias SearchPlugin::View under '/';
 
-
+##############################################################################
 package MyApp::View;
 
 use base qw/Template::Declare/;
@@ -32,32 +33,29 @@
 
 alias ListPlugin::View under 'plugin/';
 
+##############################################################################
 package main;
 Template::Declare->init( dispatch_to => ['MyApp::View'] );
 
-use Test::More tests => 12;
+use Test::More tests => 14;
 use Test::Warn;
 require "t/utils.pl";
 
-ok( MyApp::View->has_template('toplevel') );
-ok( !MyApp::View->has_template('listing') , "the listing template isn't imported to the top level");
+ok( MyApp::View->has_template('toplevel'), 'Should have toplevel template' );
+ok( !MyApp::View->has_template('listing'), "the listing template isn't imported to the top level");
 ok( !MyApp::View->has_template('search'), "The search template isn't imported to the top level" );
 ok( MyApp::View->has_template('/plugin/listing'), 'has listing template' );
 ok( MyApp::View->has_template('/plugin/search'), 'has search template' );
 
-
-
-
-
 {
     my $simple = ( Template::Declare->show('toplevel'));
-    like( $simple, qr'Toplevel' );
+    like( $simple, qr'Toplevel', 'Can execute toplevel template' );
 }
 {
     warning_like {
         my $simple = ( Template::Declare->show('listing') ||'');
         unlike( $simple, qr'listing',
-            'can not call a toplevel "listing" template' );
+            'Cannot call a toplevel "listing" template' );
         }
         qr/The template 'listing' could not be found/,
         "listing is private"
@@ -65,21 +63,21 @@
 }
 warning_like {
     my $simple = ( Template::Declare->show('search')||'');
-    unlike( $simple, qr'search', "Can not call a toplevel /search" );
+    unlike( $simple, qr'search', "Cannot call a toplevel /search" );
 } qr/The template 'search' could not be found/, "Search could not be found";
 
-
-
 {
 
     my $simple = ( Template::Declare->show('/plugin/listing'));
     like( $simple, qr'listing', "Can call /plugin/listing" );
+    $simple = ( Template::Declare->show('plugin/listing'));
+    like( $simple, qr'listing', "Can call plugin/listing" );
 }
 {
     my $simple = ( Template::Declare->show('/plugin/search'));
     like( $simple, qr'search' , "Can call /plugin/search");
+    $simple = ( Template::Declare->show('plugin/search'));
+    like( $simple, qr'search' , "Can call plugin/search");
 }
 
-
 1;
-

Modified: Template-Declare/trunk/t/relative-pathing.t
==============================================================================
--- Template-Declare/trunk/t/relative-pathing.t	(original)
+++ Template-Declare/trunk/t/relative-pathing.t	Wed Oct  7 00:00:08 2009
@@ -1,6 +1,7 @@
 use warnings;
 use strict;
 
+##############################################################################
 package Wifty::UI::aliased_pkg;
 use base qw/Template::Declare/;
 use Template::Declare::Tags;
@@ -15,6 +16,7 @@
     div { outs( 'This is a template local to ' . __PACKAGE__ ) };
 };
 
+##############################################################################
 package Wifty::UI;
 use base qw/Template::Declare/;
 use Template::Declare::Tags;
@@ -35,6 +37,7 @@
 template 'up_level_inside/local' => sub { div { "This is up_level_inside/local" } };
 
 
+##############################################################################
 package main;
 use Template::Declare::Tags;
 Template::Declare->init( dispatch_to => ['Wifty::UI'] );

Modified: Template-Declare/trunk/t/similar-aliases.t
==============================================================================
--- Template-Declare/trunk/t/similar-aliases.t	(original)
+++ Template-Declare/trunk/t/similar-aliases.t	Wed Oct  7 00:00:08 2009
@@ -9,6 +9,7 @@
 # where each alias had a "list" or something other matching thing. The template
 # resolver could match /foo/list when looking for /admin/foo/list.
 
+##############################################################################
 package Foo;
 use base qw/ Template::Declare /;
 use Template::Declare::Tags;
@@ -18,6 +19,7 @@
     div { outs( 'This is aliased from ' . $self ) };
 };
 
+##############################################################################
 package Admin::Foo;
 use base qw/ Template::Declare /;
 use Template::Declare::Tags;
@@ -27,6 +29,7 @@
     div { outs( 'This is aliased from ' . $self ) };
 };
 
+##############################################################################
 package App;
 use base qw/ Template::Declare /;
 use Template::Declare::Tags;
@@ -34,6 +37,7 @@
 alias Foo under '/foo';
 alias Admin::Foo under '/admin/foo';
 
+##############################################################################
 package main;
 use Template::Declare::Tags;
 Template::Declare->init( dispatch_to => [ 'App' ] );


More information about the Jifty-commit mailing list