3 Test lldb data formatter subsystem.
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
12 from ObjCDataFormatterTestCase import ObjCDataFormatterTestCase
15 class ObjCDataFormatterExpr(ObjCDataFormatterTestCase):
18 def test_expr_with_run_command(self):
19 """Test common cases of expression parser <--> formatters interaction."""
21 self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
22 self, '// Set break point at this line.',
23 lldb.SBFileSpec('main.m', False))
25 # The stop reason of the thread should be breakpoint.
28 STOPPED_DUE_TO_BREAKPOINT,
29 substrs=['stopped', 'stop reason = breakpoint'])
31 # This is the function to remove the custom formats in order to have a
32 # clean slate for the next test case.
34 self.runCmd('type format clear', check=False)
35 self.runCmd('type summary clear', check=False)
36 self.runCmd('type synth clear', check=False)
38 # Execute the cleanup function during test case tear down.
39 self.addTearDownHook(cleanup)
41 # check that the formatters are able to deal safely and correctly
42 # with ValueObjects that the expression parser returns
44 'expression ((id)@"Hello for long enough to avoid short string types")',
46 substrs=['Hello for long enough to avoid short string types'])
49 'expression -d run -- ((id)@"Hello for long enough to avoid short string types")',
50 substrs=['Hello for long enough to avoid short string types'])
52 self.expect('expr -d run -- label1', substrs=['Process Name'])
55 'expr -d run -- @"Hello for long enough to avoid short string types"',
56 substrs=['Hello for long enough to avoid short string types'])
59 'expr -d run --object-description -- @"Hello for long enough to avoid short string types"',
60 substrs=['Hello for long enough to avoid short string types'])
62 'expr -d run --object-description -- @"Hello"',
64 substrs=['@"Hello" Hello'])