[Zope3-checkins] CVS: Zope3/src/zope/tal/tests - test_htmltalparser.py:1.5.32.2 test_talinterpreter.py:1.3.4.17

Godefroid Chapelle gotcha at swing.be
Wed Aug 13 14:14:15 EDT 2003


Update of /cvs-repository/Zope3/src/zope/tal/tests
In directory cvs.zope.org:/tmp/cvs-serv1068

Modified Files:
      Tag: srichter-i18n-macro-interaction-branch
	test_htmltalparser.py test_talinterpreter.py 
Log Message:
- added tests with bytecode that should/could be generated
  to fix the bug



=== Zope3/src/zope/tal/tests/test_htmltalparser.py 1.5.32.1 => 1.5.32.2 ===
--- Zope3/src/zope/tal/tests/test_htmltalparser.py:1.5.32.1	Fri Aug  8 16:26:36 2003
+++ Zope3/src/zope/tal/tests/test_htmltalparser.py	Wed Aug 13 13:14:09 2003
@@ -602,6 +602,37 @@
   ('rawtextColumn', ('</span>\n', 0))
   ])
 
+    def test_i18n_name_with_content(self):
+        self._run_check('<div i18n:translate="">This is text for '
+            '<span i18n:translate="" tal:content="bar" i18n:name="bar_name"/>.'
+            '</div>', [
+('setPosition', (1, 0)),
+('beginScope', {'i18n:translate': ''}),
+('startTag', ('div', [('i18n:translate', '', 'i18n')])),
+('insertTranslation',
+ ('',
+  [('rawtextOffset', ('This is text for ', 17)),
+   ('setPosition', (1, 40)),
+   ('beginScope',
+    {'tal:content': 'bar', 'i18n:name': 'bar_name', 'i18n:translate': ''}),
+   ('i18nVariable',
+       ('bar_name',
+        [('startTag',
+           ('span',
+            [('i18n:translate', '', 'i18n'),
+             ('tal:content', 'bar', 'tal'),
+             ('i18n:name', 'bar_name', 'i18n')])),
+         ('insertTranslation',
+           ('',
+             [('insertText', ('$bar$', []))])),
+         ('rawtextOffset', ('</span>', 7))],
+      None)),
+   ('endScope', ()),
+   ('rawtextOffset', ('.', 1))])),
+('endScope', ()),
+('rawtextOffset', ('</div>', 6)) 
+  ])
+
     def test_i18n_name_implicit_value(self):
         # input/test22.html
         self._run_check('''\


=== Zope3/src/zope/tal/tests/test_talinterpreter.py 1.3.4.16 => 1.3.4.17 ===
--- Zope3/src/zope/tal/tests/test_talinterpreter.py:1.3.4.16	Wed Aug 13 10:53:09 2003
+++ Zope3/src/zope/tal/tests/test_talinterpreter.py	Wed Aug 13 13:14:09 2003
@@ -139,6 +139,38 @@
         self._check(program,
                     '<div>THIS IS TEXT FOR <span>BARVALUE</span>.</div>\n')
 
+    def test_translate_static_text_as_dynamic_from_bytecode(self):
+        program =  [('version', '1.4'),
+ ('mode', 'html'),
+('setPosition', (1, 0)),
+('beginScope', {'i18n:translate': ''}),
+('startTag', ('div', [('i18n:translate', '', 'i18n')])),
+('insertTranslation',
+ ('',
+  [('rawtextOffset', ('This is text for ', 17)),
+   ('setPosition', (1, 40)),
+   ('beginScope',
+    {'tal:content': 'bar', 'i18n:name': 'bar_name', 'i18n:translate': ''}),
+   ('i18nVariable',
+       ('bar_name',
+        [('startTag',
+           ('span',
+            [('i18n:translate', '', 'i18n'),
+             ('tal:content', 'bar', 'tal'),
+             ('i18n:name', 'bar_name', 'i18n')])),
+         ('insertTranslation',
+           ('',
+             [('insertText', ('$bar$', []))])),
+         ('rawtextOffset', ('</span>', 7))],
+      None)),
+   ('endScope', ()),
+   ('rawtextOffset', ('.', 1))])),
+('endScope', ()),
+('rawtextOffset', ('</div>', 6)) 
+]
+        self._check(program,
+                    '<div>THIS IS TEXT FOR <span>BARVALUE</span>.</div>\n')
+
     def test_for_correct_msgids(self):
 
         class CollectingTranslationService(DummyTranslationService):




More information about the Zope3-Checkins mailing list