[Jifty-commit] r7519 - Template-Declare/branches/mixmaster/t

Jifty commits jifty-commit at lists.jifty.org
Wed Oct 7 14:30:30 EDT 2009


Author: theory
Date: Wed Oct  7 14:30:30 2009
New Revision: 7519

Modified:
   Template-Declare/branches/mixmaster/t/aliasing.t
   Template-Declare/branches/mixmaster/t/importing.t

Log:
Eliminated some ambiguity in the aliasing and importing tests. The importing
tests, in particular, were not testing the template invocant they thought they
were. I updated the template to quote the full invocant name, and the `like`
test now checks for the quoted value. That means that checking to see if the
invocant is "Wifty::UI" will no longer pass when the invocant is actually
"Wifty::UI::imported_pkg". So I updated the importing test so that it now
properly checks the full invocant class.



Modified: Template-Declare/branches/mixmaster/t/aliasing.t
==============================================================================
--- Template-Declare/branches/mixmaster/t/aliasing.t	(original)
+++ Template-Declare/branches/mixmaster/t/aliasing.t	Wed Oct  7 14:30:30 2009
@@ -8,7 +8,7 @@
 
 template 'aliased' => sub {
     my $self = shift;
-    div { outs( 'This is aliased from ' . $self ) };
+    div { outs_raw "Invocant: '$self'" };
     div { 'Variable ', $self->package_variable('VARIABLE') };
 };
 
@@ -64,9 +64,9 @@
 {
     # Try the first alias with a variable set.
     ok my $simple = ( show('aliased_pkg/aliased') ), 'Should get output from alias template';
-    like( $simple, qr'This is aliased', 'Its output should be right' );
+    like( $simple, qr'Invocant:', 'Its output should be right' );
     like( $simple, qr'Variable SET' , "The variable was set");
-    like( $simple, qr'Wifty::UI::aliased_pkg',
+    like( $simple, qr{'Wifty::UI::aliased_pkg'},
         '$self is correct in template block' );
     ok_lint($simple);
 }
@@ -74,9 +74,9 @@
 {
     # Try the second alias with no variable.
     ok my $simple = ( show('aliased_pkg2/aliased') ), 'Should get output from second alias';
-    like( $simple, qr'This is aliased', 'Its output should be right' );
+    like( $simple, qr'Invocant', 'Its output should be right' );
     unlike( $simple, qr'Varialble SET' , 'But the variable should not be set');
-    like( $simple, qr'Wifty::UI::aliased_pkg',
+    like( $simple, qr{'Wifty::UI::aliased_pkg'},
         '$self is correct in template block' );
     ok_lint($simple);
 }
@@ -86,12 +86,12 @@
         'Should get output from superclass template';
     like(
         $simple,
-        qr'This is aliased',
+        qr'Invocant:',
         "We should get the aliased version in the subclass"
     );
     like(
         $simple,
-        qr'Wifty::UI::aliased_subclass_pkg',
+        qr{'Wifty::UI::aliased_subclass_pkg'},
         '$self is correct in template block'
     );
     ok_lint($simple);

Modified: Template-Declare/branches/mixmaster/t/importing.t
==============================================================================
--- Template-Declare/branches/mixmaster/t/importing.t	(original)
+++ Template-Declare/branches/mixmaster/t/importing.t	Wed Oct  7 14:30:30 2009
@@ -8,7 +8,7 @@
 
 template 'imported' => sub {
     my $self = shift;
-    div { outs( 'This is imported from ' . $self ) };
+    div { outs_raw "Invocant: '$self'" };
 };
 
 ##############################################################################
@@ -22,7 +22,7 @@
 use Template::Declare::Tags;
 
 template simple => sub {
-
+    print '# ', ref +shift, $/;
     html {
         head {};
         body { show 'private-content'; };
@@ -92,22 +92,21 @@
 
 {
     ok my $simple = ( show('imported_pkg/imported') ), 'Should get output for imported template';
-    like( $simple, qr'This is imported', 'Its output should be correct' );
-    like( $simple, qr'Wifty::UI', '$self is correct in template block' );
+    like( $simple, qr'Invocant:', 'Its output should be correct' );
+    like( $simple, qr{'Wifty::UI::imported_pkg'}, '$self is correct in template block' );
     ok_lint($simple);
 }
-
 {
     ok my $simple = ( show('imported_subclass_pkg/imported') ),
         'Should get output from imported template from subclass';
     like(
         $simple,
-        qr'This is imported',
+        qr'Invocant:',
         "We got the imported version in the subclass"
     );
     like(
         $simple,
-        qr'Wifty::UI',
+        qr{'Wifty::UI::imported_pkg'},
         '$self is correct in template block'
     );
     ok_lint($simple);


More information about the Jifty-commit mailing list