xref: /llvm-project/lldb/test/API/python_api/sbvalue_synthetic/TestSBValueSynthetic.py (revision 3068d277fd5ad0590a11dcb23af170ab31d7bda0)
1927926b8SPavel Labathimport lldb
2927926b8SPavel Labathfrom lldbsuite.test.decorators import *
3927926b8SPavel Labathfrom lldbsuite.test.lldbtest import *
4927926b8SPavel Labathfrom lldbsuite.test import lldbutil
5927926b8SPavel Labath
6927926b8SPavel Labath
7927926b8SPavel Labathclass TestSBValueSynthetic(TestBase):
8927926b8SPavel Labath    NO_DEBUG_INFO_TESTCASE = True
9927926b8SPavel Labath
10927926b8SPavel Labath    def test_str(self):
11927926b8SPavel Labath        self.build()
12927926b8SPavel Labath        lldbutil.run_to_source_breakpoint(
13927926b8SPavel Labath            self, "break here", lldb.SBFileSpec("main.cpp")
14927926b8SPavel Labath        )
15*3068d277SPavel Labath        self.runCmd("command script import formatter.py")
16*3068d277SPavel Labath        self.runCmd(
17*3068d277SPavel Labath            "type synthetic add --python-class formatter.FooSyntheticProvider Foo"
18*3068d277SPavel Labath        )
19927926b8SPavel Labath
20*3068d277SPavel Labath        formatted = self.frame().FindVariable("foo")
21*3068d277SPavel Labath        has_formatted = self.frame().FindVariable("has_foo")
22*3068d277SPavel Labath        self.expect(str(formatted), exe=False, substrs=["synth_child"])
23*3068d277SPavel Labath        self.expect(str(has_formatted), exe=False, substrs=["synth_child"])
24