xref: /llvm-project/lldb/test/API/python_api/sbvalue_synthetic/TestSBValueSynthetic.py (revision 3068d277fd5ad0590a11dcb23af170ab31d7bda0)
1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6
7class TestSBValueSynthetic(TestBase):
8    NO_DEBUG_INFO_TESTCASE = True
9
10    def test_str(self):
11        self.build()
12        lldbutil.run_to_source_breakpoint(
13            self, "break here", lldb.SBFileSpec("main.cpp")
14        )
15        self.runCmd("command script import formatter.py")
16        self.runCmd(
17            "type synthetic add --python-class formatter.FooSyntheticProvider Foo"
18        )
19
20        formatted = self.frame().FindVariable("foo")
21        has_formatted = self.frame().FindVariable("has_foo")
22        self.expect(str(formatted), exe=False, substrs=["synth_child"])
23        self.expect(str(has_formatted), exe=False, substrs=["synth_child"])
24