1import lldb
2from lldbsuite.test.lldbtest import *
3from lldbsuite.test.decorators import *
4import lldbsuite.test.lldbutil as lldbutil
5
6
7class TestDataFormatterCaching(TestBase):
8
9    def test_with_run_command(self):
10        """
11        Test that hardcoded summary formatter matches aren't improperly cached.
12        """
13        self.build()
14        target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
15            self, 'break here', lldb.SBFileSpec('a.c'))
16        valobj = self.frame().FindVariable('f')
17        self.assertEqual(valobj.GetValue(), '4')
18        bkpt_b = target.BreakpointCreateBySourceRegex('break here',
19                                                      lldb.SBFileSpec('b.c'))
20        lldbutil.continue_to_breakpoint(process, bkpt_b)
21        valobj = self.frame().FindVariable('f4')
22        self.assertEqual(valobj.GetSummary(), '(1, 2, 3, 4)')
23