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

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Mar 23 22:22:25 EDT 2007


Author: clkao
Date: Fri Mar 23 22:22:25 2007
New Revision: 3052

Modified:
   Template-Declare/lib/Template/Declare/Tags.pm
   Template-Declare/t/subclassing.t

Log:
When calling show, look at the current context rather than global.
This breaks a test that is arguably wrong by introducing collision.


Modified: Template-Declare/lib/Template/Declare/Tags.pm
==============================================================================
--- Template-Declare/lib/Template/Declare/Tags.pm	(original)
+++ Template-Declare/lib/Template/Declare/Tags.pm	Fri Mar 23 22:22:25 2007
@@ -382,15 +382,21 @@
     my $template = shift;
 
     my $INSIDE_TEMPLATE = 0;
+    my $calling_class = caller();
 
     # if we're inside a template, we should show private templates
-    if ( caller()->isa('Template::Declare') ) { $INSIDE_TEMPLATE = 1; }
-    else { Template::Declare->new_buffer_frame }
+    if ( $calling_class->isa('Template::Declare') ) {
+        $INSIDE_TEMPLATE = 1;
+    }
+    else {
+	$calling_class = 'Template::Declare';
+        Template::Declare->new_buffer_frame;
+    }
 
     my $callable =
         ref($template) eq 'CODE'
         ? $template
-        : Template::Declare->has_template( $template, $INSIDE_TEMPLATE );
+        : $calling_class->has_template( $template, $INSIDE_TEMPLATE );
 
     # If the template was not found let the user know.
     unless ( $callable ) {        

Modified: Template-Declare/t/subclassing.t
==============================================================================
--- Template-Declare/t/subclassing.t	(original)
+++ Template-Declare/t/subclassing.t	Fri Mar 23 22:22:25 2007
@@ -63,12 +63,14 @@
     ok_lint($simple);
 }
 
-
 Template::Declare->init(
     roots => [ 'Baseclass::UI', 'Wifty::UI', 'Childclass::UI' ] );
 {
     my $simple = ( show('simple') );
+TODO: {
+local $TODO = 'This is actually collision';
     like( $simple, qr'This is child class content' );
+}
     ok_lint($simple);
 }
 


More information about the Jifty-commit mailing list