Ticket #2594: template_whitespace_ticket_2594_tests.diff

File template_whitespace_ticket_2594_tests.diff, 2.1 KB (added by jshedd, 14 years ago)

Tests for whitespace collapsing.

  • regressiontests/templates/tests.py

     
    965965            'templatetag10': ('{% templatetag closebrace %}{% templatetag closebrace %}', {}, '}}'),
    966966            'templatetag11': ('{% templatetag opencomment %}', {}, '{#'),
    967967            'templatetag12': ('{% templatetag closecomment %}', {}, '#}'),
    968 
     968           
     969            # WHITESPACE TESTING
     970            # Tags on their own line should collapse the newline before them
     971            'templatetag-whitespace01': ('\n {% templatetag openblock %}\n', {}, '{%\n'),
     972            # Tags that start on a newline, but have content thereafter, should not collapse the newline before or after them.
     973            'templatetag-whitespace02': ('\n {% templatetag openblock %} String', {}, '\n {% String'),
     974            'templatetag-whitespace03': ('\n {% templatetag openblock %} String \n', {}, '\n {% String \n'),
     975            'templatetag-whitespace04': ('\n {% templatetag openbrace %}\nString\n{% templatetag closebrace %}\n', {}, '{\nString}\n'),
     976            'templatetag-whitespace05': ('\n {% templatetag openbrace %}String{% templatetag closebrace %}\n', {}, '\n {String}\n'),
     977            'templatetag-whitespace06': ('\n {% templatetag openbrace %}String{% templatetag closebrace %}', {}, '\n {String}'),
     978            'templatetag-whitespace07': (' {% templatetag openbrace %}String{% templatetag closebrace %}', {}, ' {String}'),
     979           
    969980            ### WIDTHRATIO TAG ########################################################
    970981            'widthratio01': ('{% widthratio a b 0 %}', {'a':50,'b':100}, '0'),
    971982            'widthratio02': ('{% widthratio a b 100 %}', {'a':0,'b':0}, ''),
     
    10821093            # implementation details (fortunately, the (no)autoescape block
    10831094            # tags can be used in those cases)
    10841095            'autoescape-filtertag01': ("{{ first }}{% filter safe %}{{ first }} x<y{% endfilter %}", {"first": "<a>"}, template.TemplateSyntaxError),
     1096           
    10851097        }
    10861098
    10871099if __name__ == "__main__":
Back to Top