Пример #1
0
 def test_one_stack_frame(self):
     """Ensure it does nothing when there's only one stack frame"""
     stack = '\n'.join([
         'random', '#0 0x3 test0', '#1 0x2 test2', '#2 0x1 test1',
         '#3 0x0 test0', 'random'
     ])
     self.assertEqual(show.highlight_common_stack_frames(stack), stack)
Пример #2
0
 def test_highlight(self):
   """Ensure it highlights the last 3 lines of the first two crash stacks."""
   stack = '\n'.join([
       'random', '#0 0x3 test0', '#1 0x2 test2', '#2 0x1 test1',
       '#3 0x0 test0', 'random', '#0 0x4 test4', '#1 0x2 test2',
       '#2 0x1 test1', '#3 0x0 test0', 'random', '#0 0x5 test5',
       '#1 0x2 test2', '#2 0x1 test1', '#3 0x0 test0'
   ])
   expected = '\n'.join([
       'random', '#0 0x3 test0', '<b>#1 0x2 test2</b>', '<b>#2 0x1 test1</b>',
       '<b>#3 0x0 test0</b>', 'random', '#0 0x4 test4', '<b>#1 0x2 test2</b>',
       '<b>#2 0x1 test1</b>', '<b>#3 0x0 test0</b>', 'random', '#0 0x5 test5',
       '#1 0x2 test2', '#2 0x1 test1', '#3 0x0 test0'
   ])
   self.assertEqual(show.highlight_common_stack_frames(stack), expected)