[Zope-Checkins] CVS: Products/PageTemplates/tests - testDTMLTests.py:1.8.108.1

Fred L. Drake, Jr. fdrake at gmail.com
Tue Mar 14 12:48:51 EST 2006


Update of /cvs-repository/Products/PageTemplates/tests
In directory cvs.zope.org:/tmp/cvs-serv1857/lib/python/Products/PageTemplates/tests

Modified Files:
      Tag: zc-Zope-2-7-5
	testDTMLTests.py 
Log Message:
add tests for on-error handling in macros for errors in slot fillers; errors
in the filler can now be handled by the macro, as intended


=== Products/PageTemplates/tests/testDTMLTests.py 1.8 => 1.8.108.1 ===
--- Products/PageTemplates/tests/testDTMLTests.py:1.8	Wed Sep 18 11:12:46 2002
+++ Products/PageTemplates/tests/testDTMLTests.py	Tue Mar 14 12:48:20 2006
@@ -135,9 +135,49 @@
         expect = util.read_output('DTML3.html')
         util.check_xml(expect, o)
 
+    def check_on_error_in_slot_filler(self):
+        # The `here` isn't defined, so the macro definition is
+        # expected to catch the error that gets raised.
+        text = '''\
+            <div metal:define-macro="foo">
+               <div tal:on-error="string:eek">
+                  <div metal:define-slot="slot" />
+                  cool
+               </div>
+            </div>
+
+            <div metal:use-macro="template/macros/foo">
+               <div metal:fill-slot="slot">
+                  <p tal:content="here/xxx" />
+               </div>
+            </div>
+            '''
+        self.t.write(text)
+        aa = util.argv(('one', 'two', 'three', 'four', 'five'))
+        self.t.__of__(aa)()
+
+    def check_on_error_in_slot_default(self):
+        # The `here` isn't defined, so the macro definition is
+        # expected to catch the error that gets raised.
+        text = '''\
+            <div metal:define-macro="foo">
+               <div tal:on-error="string:eek">
+                  <div metal:define-slot="slot">
+                    <div tal:content="here/xxx" />
+                  </div>
+               </div>
+            </div>
+
+            <div metal:use-macro="template/macros/foo">
+            </div>
+            '''
+        self.t.write(text)
+        aa = util.argv(('one', 'two', 'three', 'four', 'five'))
+        self.t.__of__(aa)()
+
+
 def test_suite():
     return unittest.makeSuite(DTMLTests, 'check')
 
 if __name__=='__main__':
     main()
-



More information about the Zope-Checkins mailing list