[Jifty-commit] r3232 - in Template-Declare: t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sat May 12 01:25:38 EDT 2007


Author: jesse
Date: Sat May 12 01:25:37 2007
New Revision: 3232

Added:
   Template-Declare/t/deep_aliasing.t
Modified:
   Template-Declare/   (props changed)

Log:
 r56803 at pinglin:  jesse | 2007-05-12 00:37:02 -0400
  Tests to show that recursive aliasing breaks


Added: Template-Declare/t/deep_aliasing.t
==============================================================================
--- (empty file)
+++ Template-Declare/t/deep_aliasing.t	Sat May 12 01:25:37 2007
@@ -0,0 +1,73 @@
+use warnings;
+use strict;
+
+
+package Plugin2::View;
+
+use base qw/Template::Declare/;
+use Template::Declare::Tags;
+
+template 'search' => sub {
+    h1 {'Plugin2::View::search'};
+};
+
+package Plugin1::View;
+
+use base qw/Template::Declare/;
+use Template::Declare::Tags;
+
+template 'listing' => sub {
+    h1 {'Plugin1::View::listing'};
+};
+
+alias Plugin2::View under '/';
+
+
+package MyApp::View;
+
+use base qw/Template::Declare/;
+use Template::Declare::Tags;
+
+template 'toplevel' => sub {h1{'Toplevel'}};
+
+alias Plugin1::View under '/plugin';
+
+package main;
+Template::Declare->init( roots => ['MyApp::View'] );
+
+use Test::More tests => 16;
+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('/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' );
+}
+{
+    my $simple = ( Template::Declare->show('listing'));
+    unlike( $simple, qr'listing' , 'can not call a toplevel "listing" template');
+}
+{
+    my $simple = ( Template::Declare->show('/plugin/listing'));
+    like( $simple, qr'listing', "Can call /plugin/listing" );
+}
+{
+    my $simple = ( Template::Declare->show('search'));
+    unlike( $simple, qr'search', "Can not call a toplevel /search" );
+}
+{
+    my $simple = ( Template::Declare->show('/plugin/search'));
+    like( $simple, qr'search' , "Can call /plugin/search");
+}
+
+
+1;


More information about the Jifty-commit mailing list