[Jifty-commit] r3841 - in Template-Declare: t
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Aug 10 07:29:11 EDT 2007
Author: agentz
Date: Fri Aug 10 07:29:11 2007
New Revision: 3841
Added:
Template-Declare/t/namespace.t
Modified:
Template-Declare/MANIFEST
Template-Declare/MANIFEST.SKIP
Log:
TD - added t/namespace.t for testing the new XML namespace support; updated MANIFEST accordingly
Modified: Template-Declare/MANIFEST
==============================================================================
--- Template-Declare/MANIFEST (original)
+++ Template-Declare/MANIFEST Fri Aug 10 07:29:11 2007
@@ -7,12 +7,12 @@
inc/Module/Install/Metadata.pm
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
-lib/HTML/TagSet.pm
lib/Template/Declare.pm
lib/Template/Declare/Buffer.pm
lib/Template/Declare/Tags.pm
lib/Template/Declare/TagSet.pm
-lib/XUL/TagSet.pm
+lib/Template/Declare/TagSet/HTML.pm
+lib/Template/Declare/TagSet/XUL.pm
Makefile.PL
MANIFEST This list of files
MANIFEST.SKIP
@@ -32,6 +32,7 @@
t/forms.t
t/importing.t
t/indexhtml.t
+t/namespace.t
t/private.t
t/relative-pathing.t
t/self.t
Modified: Template-Declare/MANIFEST.SKIP
==============================================================================
--- Template-Declare/MANIFEST.SKIP (original)
+++ Template-Declare/MANIFEST.SKIP Fri Aug 10 07:29:11 2007
@@ -1,4 +1,5 @@
^a$
+\.swo$
^Template-Declare-\d+\.\d+
^.*ref.*\.xml
^t\.sh$
Added: Template-Declare/t/namespace.t
==============================================================================
--- (empty file)
+++ Template-Declare/t/namespace.t Fri Aug 10 07:29:11 2007
@@ -0,0 +1,66 @@
+use strict;
+use warnings;
+use Test::More tests => 4;
+
+package MyApp::Templates;
+
+use base 'Template::Declare';
+use Template::Declare::Tags
+ 'XUL', HTML => { namespace => 'html' };
+
+template main => sub {
+ groupbox {
+ caption { attr { label => 'Colors' } }
+ html::div { html::p { 'howdy!' } }
+ html::br {}
+ }
+};
+
+package MyApp::Templates2;
+
+use base 'Template::Declare';
+use Template::Declare::Tags
+ 'XUL', HTML => {
+ namespace => 'htm',
+ package => 'MyHtml'
+ };
+
+template main => sub {
+ groupbox {
+ caption { attr { label => 'Colors' } }
+ MyHtml::div { MyHtml::p { 'howdy!' } }
+ MyHtml::br {}
+ }
+};
+
+eval "htm::div {};";
+::ok $@, 'htm:: is invalid';
+::like $@, qr/Can't locate object method "div" via package "htm"/, 'package htm is intact';
+
+package main;
+Template::Declare->init( roots => ['MyApp::Templates']);
+my $out = Template::Declare->show('main') . "\n";
+is $out, <<_EOC_;
+
+<groupbox>
+ <caption label="Colors" />
+ <html:div>
+ <html:p>howdy!</html:p>
+ </html:div>
+ <html:br></html:br>
+</groupbox>
+_EOC_
+
+Template::Declare->init( roots => ['MyApp::Templates2']);
+$out = Template::Declare->show('main') . "\n";
+is $out, <<_EOC_;
+
+<groupbox>
+ <caption label="Colors" />
+ <htm:div>
+ <htm:p>howdy!</htm:p>
+ </htm:div>
+ <htm:br></htm:br>
+</groupbox>
+_EOC_
+
More information about the Jifty-commit
mailing list