Edgewall Software

Ticket #3262: mimeview-html-splitlines-close-order.diff

File mimeview-html-splitlines-close-order.diff, 1.2 KB (added by Tim Hatch <trac@…>, 3 years ago)

Added test for api.py

  • trac/mimeview/tests/api.py

     
    8080        self.assertEqual('<span class="p_tripledouble">Test</span>', result[3]) 
    8181        self.assertEqual('<span class="p_tripledouble">"""</span>', result[4]) 
    8282 
     83    def test_html_splitlines_with_comment(self): 
     84        """ 
     85        Trac isn't rendering multiline comments correctly anymore. 
     86        """ 
     87        lines = ['<span class="code-lang">&lt;?php', 
     88                 '</span><span class="code-comment">/*', 
     89                 'Test - this is a comment', 
     90                 '*/</span>'] 
     91        result = list(_html_splitlines(lines)) 
     92        self.assertEqual('<span class="code-lang">&lt;?php</span>', result[0]) 
     93        self.assertEqual('<span class="code-lang"></span><span class="code-comment">/*</span>', result[1]) 
     94        self.assertEqual('<span class="code-comment">Test - this is a comment</span>', result[2]) 
     95        self.assertEqual('<span class="code-comment">*/</span>', result[3]) 
     96        self.assertEqual(4, len(result)) 
    8397 
    8498def suite(): 
    8599    suite = unittest.TestSuite()