Files
clang-p2996/lldb/test/API/python_api/format/TestFormat.py
Walter Erquinigo d9ec4b24a8 [lldb-dap] Add an option to provide a format for stack frames (#71843)
When this option gets enabled, descriptions of stack frames will be
generated using the format provided in the launch configuration instead
of simply calling `SBFrame::GetDisplayFunctionName`. This allows
lldb-dap to show an output similar to the one in the CLI.
2023-11-13 21:10:16 -05:00

25 lines
723 B
Python

"""
Test the lldb Python SBFormat API.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
class FormatAPITestCase(TestBase):
def test_format(self):
format = lldb.SBFormat()
self.assertFalse(format)
error = lldb.SBError()
format = lldb.SBFormat("${bad}", error)
self.assertIn("invalid top level item 'bad'", error.GetCString())
self.assertFalse(format) # We expect an invalid object back if we have an error
self.assertTrue(error.Fail())
format = lldb.SBFormat("${frame.index}", error)
self.assertIs(error.GetCString(), None)
self.assertTrue(format)
self.assertTrue(error.Success())