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